From 9bc3059e6b803ff5341a8ebc5763a3e6b17fcb4e Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sun, 25 Aug 2024 18:14:24 +0000 Subject: [PATCH] flake: extract nixosModules as submodule --- flake.nix | 92 +------------------------------------------ nix/nixos/default.nix | 91 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 91 deletions(-) create mode 100644 nix/nixos/default.nix diff --git a/flake.nix b/flake.nix index c2c5b96..840b357 100644 --- a/flake.nix +++ b/flake.nix @@ -100,97 +100,7 @@ result; }; - nixosConfigurations = - let - nixpkgs = inputs.nixpkgs; - nixosSystem = - { modules, system }: - let - modsExtended = [ - outputs.nixosModules.myOptions - outputs.nixosModules.withDepends - { home-manager.sharedModules = [ outputs.homeManagerModules.default ]; } - ] ++ modules; - in - nixpkgs.lib.nixosSystem { - modules = modsExtended; - specialArgs = { - flake = flakeArg; - }; - inherit system; - }; - in - { - - "x13yz" = nixosSystem { - modules = [ - { - # TODO check if required & hide into modules - boot = { - initrd = { - availableKernelModules = [ - "nvme" # nvme (probably required for booting) - "rtsx_pci_sdmmc" # probably for SD card (required for booting?) - "xhci_pci" # for USB 3.0 (required for booting?) - ]; - kernelModules = [ - "dm-snapshot" # pseudo-required for LVM - ]; - }; - kernelModules = [ - "kvm-intel" # do not know if that is required here? - ]; - }; - } - inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x13-yoga - { - # hardware - hardware.cpu.type = "intel"; - hardware.graphics.intel.enable = true; - programs.captive-browser.interface = "wlp0s20f3"; - } - { - # as currently installed - boot.initrd.luks.devices."luks-herske.lvm.6nw.de" = { - device = "/dev/disk/by-uuid/16b8f83d-0450-4c4d-9964-788575a31eec"; - preLVM = true; - allowDiscards = true; - }; - fileSystems."/" = { - device = "/dev/disk/by-uuid/c93557db-e7c5-46ef-9cd8-87eb7c5753dc"; - fsType = "ext4"; - options = [ - "relatime" - "discard" - ]; - }; - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/5F9A-9A2D"; - fsType = "vfat"; - options = [ - "uid=0" - "gid=0" - "fmask=0077" - "dmask=0077" - ]; - }; - swapDevices = [ { device = "/dev/disk/by-uuid/8482463b-ceb3-40b3-abef-b49df2de88e5"; } ]; - system.stateVersion = "24.05"; - x-banananetwork.sshHostPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG71dtqG/c0AiFBN9OxoLD35TDQm3m8LXj/BQw60PE0h root@x13yz.pc.6nw.de 2024-07-01"; - } - { - # host configuration - networking.domain = "pc.6nw.de"; - networking.hostName = "x13yz"; - services.fprintd.enable = true; - x-banananetwork.frontend.convertable = true; - x-banananetwork.frontend.enable = true; - } - ]; - system = "x86_64-linux"; - }; - - }; + nixosConfigurations = importFlakeMod ./nix/nixos; nixosModules = importFlakeMod ./nix/nixos-modules; diff --git a/nix/nixos/default.nix b/nix/nixos/default.nix new file mode 100644 index 0000000..e3e46d6 --- /dev/null +++ b/nix/nixos/default.nix @@ -0,0 +1,91 @@ +{ inputs, outputs, ... }@flakeArg: +let + nixpkgs = inputs.nixpkgs; + nixosSystem = + { modules, system }: + let + modsExtended = [ + outputs.nixosModules.myOptions + outputs.nixosModules.withDepends + { home-manager.sharedModules = [ outputs.homeManagerModules.default ]; } + ] ++ modules; + in + nixpkgs.lib.nixosSystem { + modules = modsExtended; + specialArgs = { + flake = flakeArg; + }; + inherit system; + }; +in +{ + + "x13yz" = nixosSystem { + modules = [ + { + # TODO check if required & hide into modules + boot = { + initrd = { + availableKernelModules = [ + "nvme" # nvme (probably required for booting) + "rtsx_pci_sdmmc" # probably for SD card (required for booting?) + "xhci_pci" # for USB 3.0 (required for booting?) + ]; + kernelModules = [ + "dm-snapshot" # pseudo-required for LVM + ]; + }; + kernelModules = [ + "kvm-intel" # do not know if that is required here? + ]; + }; + } + inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x13-yoga + { + # hardware + hardware.cpu.type = "intel"; + hardware.graphics.intel.enable = true; + programs.captive-browser.interface = "wlp0s20f3"; + } + { + # as currently installed + boot.initrd.luks.devices."luks-herske.lvm.6nw.de" = { + device = "/dev/disk/by-uuid/16b8f83d-0450-4c4d-9964-788575a31eec"; + preLVM = true; + allowDiscards = true; + }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/c93557db-e7c5-46ef-9cd8-87eb7c5753dc"; + fsType = "ext4"; + options = [ + "relatime" + "discard" + ]; + }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/5F9A-9A2D"; + fsType = "vfat"; + options = [ + "uid=0" + "gid=0" + "fmask=0077" + "dmask=0077" + ]; + }; + swapDevices = [ { device = "/dev/disk/by-uuid/8482463b-ceb3-40b3-abef-b49df2de88e5"; } ]; + system.stateVersion = "24.05"; + x-banananetwork.sshHostPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG71dtqG/c0AiFBN9OxoLD35TDQm3m8LXj/BQw60PE0h root@x13yz.pc.6nw.de 2024-07-01"; + } + { + # host configuration + networking.domain = "pc.6nw.de"; + networking.hostName = "x13yz"; + services.fprintd.enable = true; + x-banananetwork.frontend.convertable = true; + x-banananetwork.frontend.enable = true; + } + ]; + system = "x86_64-linux"; + }; + +}