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

Aus Wiki StuRa HTW Dresden
Zur Navigation springen Zur Suche springen
 
(6 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 7: Zeile 7:
* https://florianfranke.dev/posts/2020/03/installing-nixos-with-encrypted-zfs-on-a-netcup.de-root-server/
* https://florianfranke.dev/posts/2020/03/installing-nixos-with-encrypted-zfs-on-a-netcup.de-root-server/
* https://nixos.wiki/wiki/ZFS
* https://nixos.wiki/wiki/ZFS
* https://gist.github.com/byrongibson/1578914d03a5c0a01a13f9ec53ee0b0a
* https://www.reddit.com/r/NixOS/comments/o1er2p/comment/h22f1b9/


== SnowflakeOS ==
== SnowflakeOS ==
Zeile 182: Zeile 184:
</pre>
</pre>
-->
-->
==== SnowflakeOS snowflake.nix ====
: <code>less /etc/nixos/snowflake.nix</code>
<pre>
{ 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;
}
</pre>
==== SnowflakeOS flake.nix ====
: <code>less /etc/nixos/flake.nix</code>
<pre>
{
  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; };
    };
  };
}
</pre>
== Umstellung auf [https://www.freedesktop.org/software/systemd/man/systemd.network.html systemd.network] ==
<pre>
  systemd.network.enable = true;
</pre>
<pre>
  networking.useNetworkd
</pre>
(erst) ab 23.05 verfügbar
<pre>
  systemd.network.wait-online.enable
</pre>
== Infrastruktur für Gruppen ==
* https://gitea.c3d2.de/c3d2/nix-config
* https://github.com/dd-ix/nix-config
* https://git.infra4future.de/hacc/haccfiles
== flakeify asap ==
https://nixos.asia/en/nixos-install-flake
https://oblivious.observer/posts/nixos-configuration-using-flakes/

Aktuelle Version vom 4. Mai 2024, 20:36 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/