Diskussion:Install-Party/NixOS: Unterschied zwischen den Versionen

Aus Wiki StuRa HTW Dresden
Zur Navigation springen Zur Suche springen
Neuer Abschnitt flakeify asap
 
(Eine dazwischenliegende Version von einem anderen Benutzer wird nicht angezeigt)
Zeile 263: Zeile 263:


https://nixos.asia/en/nixos-install-flake
https://nixos.asia/en/nixos-install-flake
https://oblivious.observer/posts/nixos-configuration-using-flakes/
== für die Einrichtung vielleicht interessante (besonders berücksichenswerte) Anleitungen ==
https://haseebmajid.dev/posts/2025-12-31-how-to-setup-a-new-pc-with-lanzaboote-tpm-decryption-sops-nix-impermanence-nixos-anywhere/

Aktuelle Version vom 21. Februar 2026, 12:14 Uhr

deklarative Erstellungen von Partitionierung von Geräten für Massenspeicher

[Bearbeiten]

https://github.com/nix-community/disko

NixOS meets ZFS

[Bearbeiten]

SnowflakeOS

[Bearbeiten]
2023-02-13

SnowflakeOS hardware-configuration.nix

[Bearbeiten]
less /etc/nixos/hardware-configuration.nix

{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];
  boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];
  fileSystems."/" =
    { device = "/dev/disk/by-uuid/5273542a-08f3-4012-abc0-517ca8a0c5c7";
      fsType = "ext4";
    };

  fileSystems."/boot/efi" =
    { device = "/dev/disk/by-uuid/0F19-DD1A";
      fsType = "vfat";
    };
  swapDevices = [ ];
  networking.useDHCP = lib.mkDefault true;
  # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true;
  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

SnowflakeOS configuration.nix

[Bearbeiten]
less /etc/nixos/configuration.nix

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];
  system.stateVersion = "23.05"; # Did you read the comment?
  nix.extraOptions = ''
    experimental-features = nix-command flakes
  '';
  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.loader.efi.efiSysMountPoint = "/boot/efi";
  # Define your hostname.
  networking.hostName = "snowflakeos";
  # Enable networking
  networking.networkmanager.enable = true;
  # Set your time zone.
  time.timeZone = "Europe/Berlin";
  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";
  # Set the keyboard layout.
  services.xserver.layout = "de";
  console.useXkbConfig = true;
  # Enable the X11 windowing system.
  services.xserver.enable = true;
  # Enable the GNOME Desktop Environment.
  services.xserver.displayManager.gdm.enable = true;
  services.xserver.desktopManager.gnome.enable = true;
  # Enable CUPS to print documents.
  services.printing.enable = true;
  # Enable sound with pipewire.
  sound.enable = true;
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
  };
  # Enable automatic login for the user.
  services.xserver.displayManager.autoLogin.enable = true;
  services.xserver.displayManager.autoLogin.user = "k";
  # Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
  systemd.services."getty@tty1".enable = false;
  systemd.services."autovt@tty1".enable = false;
  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;
  environment.sessionVariables.NIXPKGS_ALLOW_UNFREE = "1";
  environment.enableAllTerminfo = true;
  # List packages installed in system profile.
  environment.systemPackages = with pkgs; [
    ddate
  ];
  powerManagement.enable = true;
  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users."k" = {
    isNormalUser = true;
    description = "k-ot";
    extraGroups = [ "wheel" "networkmanager" "dialout" ];
  };
}

SnowflakeOS snowflake.nix

[Bearbeiten]
less /etc/nixos/snowflake.nix
{ config, pkgs, inputs, system, ... }:
{
  environment.systemPackages = [
    inputs.nix-software-center.packages.${system}.nix-software-center
    inputs.nixos-conf-editor.packages.${system}.nixos-conf-editor
    inputs.snow.packages.${system}.snow
    pkgs.git # For rebuiling with github flakes
  ];
  programs.nix-data = {
    systemconfig = "/etc/nixos/configuration.nix";
    flake = "/etc/nixos/flake.nix";
    flakearg = "snowflakeos";
  };
  snowflakeos.gnome.enable = true;
  snowflakeos.osInfo.enable = true;
}

SnowflakeOS flake.nix

[Bearbeiten]
less /etc/nixos/flake.nix
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    snowflake.url = "github:snowflakelinux/snowflake-modules";
    nix-data.url = "github:snowflakelinux/nix-data";
    nix-software-center.url = "github:vlinkz/nix-software-center";
    nixos-conf-editor.url = "github:vlinkz/nixos-conf-editor";
    snow.url = "github:snowflakelinux/snow";
  };
  outputs = { self, nixpkgs, ... }@inputs:
    let
      system = "x86_64-linux";
    in
    {
      nixosConfigurations."snowflakeos" = nixpkgs.lib.nixosSystem {
        inherit system;
        modules = [
          ./configuration.nix
          ./snowflake.nix
          inputs.snowflake.nixosModules.snowflake
          inputs.nix-data.nixosModules.${system}.nix-data
        ];
        specialArgs = { inherit inputs; inherit system; };
    };
  };
}

Umstellung auf systemd.network

[Bearbeiten]
  systemd.network.enable = true;
  networking.useNetworkd

(erst) ab 23.05 verfügbar

  systemd.network.wait-online.enable 

Infrastruktur für Gruppen

[Bearbeiten]

flakeify asap

[Bearbeiten]

https://nixos.asia/en/nixos-install-flake

https://oblivious.observer/posts/nixos-configuration-using-flakes/

für die Einrichtung vielleicht interessante (besonders berücksichenswerte) Anleitungen

[Bearbeiten]

https://haseebmajid.dev/posts/2025-12-31-how-to-setup-a-new-pc-with-lanzaboote-tpm-decryption-sops-nix-impermanence-nixos-anywhere/