diff --git a/flake.nix b/flake.nix index 37344ebd..90971fd7 100644 --- a/flake.nix +++ b/flake.nix @@ -67,9 +67,9 @@ }; }; - outputs = inputs: + outputs = inputs: { nixosConfigurations = { - nixosConfigurations."chn-PC" = inputs.nixpkgs.lib.nixosSystem + "chn-PC" = inputs.nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { inherit inputs; }; @@ -122,5 +122,32 @@ ./modules/home/chn.nix ]; }; - }; + + "chn-nixos-test" = inputs.nixpkgs.lib.nixosSystem + { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = + [ + inputs.home-manager.nixosModules.home-manager + inputs.sops-nix.nixosModules.sops + inputs.nix-index-database.nixosModules.nix-index + ( import ./modules/basic.nix { hostName = "chn-nixos-test"; }) + ( import ./modules/i18n.nix { fcitx = false; } ) + ./modules/sops.nix + ( import ./modules/boot/basic.nix { efi = true; timeout = 30; }) + ./modules/boot/chn-nixos-test.nix + ./modules/filesystem/chn-nixos-test.nix + ./modules/hardware/chn-nixos-test.nix + ./modules/networking/basic.nix + ./modules/networking/ssh.nix + ./modules/packages/terminal.nix + ./modules/users/root.nix + ./modules/users/chn.nix + ./modules/virtualisation/kvm_guest.nix + ./modules/home/root.nix + ./modules/home/chn.nix + ]; + }; + }; }; } diff --git a/modules/basic.nix b/modules/basic.nix index b752c0c1..783d192d 100644 --- a/modules/basic.nix +++ b/modules/basic.nix @@ -26,6 +26,5 @@ services.nix-daemon.serviceConfig.Slice = "-.slice"; }; programs.nix-ld.enable = true; - environment.systemPackages = [ inputs.inputs.nix-alien.packages.x86_64-linux.nix-alien ]; }; } diff --git a/modules/boot/basic.nix b/modules/boot/basic.nix index 80dcfb18..58adfed1 100644 --- a/modules/boot/basic.nix +++ b/modules/boot/basic.nix @@ -11,18 +11,6 @@ efi.canTouchEfiVariables = efi; }; initrd.systemd.enable = true; - kernelPackages = ( inputs.inputs.nixpkgs.lib.nixosSystem - { - system = "x86_64-linux"; - modules = - [{ - nixpkgs = - { - hostPlatform = { system = "x86_64-linux"; gcc = { arch = "alderlake"; tune = "alderlake"; }; }; - config.allowUnfree = true; - }; - }]; - } ).pkgs.linuxPackages_xanmod_latest; }; hardware.enableAllFirmware = true; }; diff --git a/modules/boot/chn-PC.nix b/modules/boot/chn-PC.nix index 955ab66e..b96aacec 100644 --- a/modules/boot/chn-PC.nix +++ b/modules/boot/chn-PC.nix @@ -4,6 +4,18 @@ inputs: { boot = { + kernelPackages = ( inputs.inputs.nixpkgs.lib.nixosSystem + { + system = "x86_64-linux"; + modules = + [{ + nixpkgs = + { + hostPlatform = { system = "x86_64-linux"; gcc = { arch = "alderlake"; tune = "alderlake"; }; }; + config.allowUnfree = true; + }; + }]; + } ).pkgs.linuxPackages_xanmod_latest; initrd.availableKernelModules = [ "ahci" "i915" "intel_cstate" "nvidia" "nvidia_drm" "nvidia_modeset" "nvidia_uvm" "nvme" "sr_mod" diff --git a/modules/boot/chn-nixos-test.nix b/modules/boot/chn-nixos-test.nix new file mode 100644 index 00000000..c997a38f --- /dev/null +++ b/modules/boot/chn-nixos-test.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }@inputs: +{ + config = + { + boot = + { + kernelPackages = inputs.pkgs.linuxPackages_xanmod_latest; + initrd.availableKernelModules = [ "ahci" "sr_mod" "usb_storage" "virtio_blk" "virtio_pci" "xhci_pci" ]; + }; + }; +} diff --git a/modules/filesystem/chn-nixos-test.nix b/modules/filesystem/chn-nixos-test.nix new file mode 100644 index 00000000..006dc71b --- /dev/null +++ b/modules/filesystem/chn-nixos-test.nix @@ -0,0 +1,25 @@ +{ + config = + { + fileSystems = + { + "/" = + { + device = "/dev/mapper/root"; + fsType = "btrfs"; + options = [ "subvol=@root,compress-force=zstd:15" ]; + }; + "/boot" = + { + device = "/dev/disk/by-uuid/18C6-B1F4"; + fsType = "vfat"; + }; + }; + boot.initrd.luks.devices.root = + { + device = "/dev/disk/by-partuuid/4f419ebd-2b49-4959-aa5f-46cfdd0cfc3e"; + header = "/dev/disk/by-partuuid/b0255c40-fd3c-4c95-9af7-4d64ad2e450f"; + allowDiscards = true; + }; + }; +} diff --git a/modules/hardware/chn-nixos-test.nix b/modules/hardware/chn-nixos-test.nix new file mode 100644 index 00000000..8e1c4b0e --- /dev/null +++ b/modules/hardware/chn-nixos-test.nix @@ -0,0 +1 @@ +{ config.nix.settings.system-features = [ "gccarch-alderlake" ]; } diff --git a/modules/packages/terminal.nix b/modules/packages/terminal.nix index 2fd701b3..f65cddba 100644 --- a/modules/packages/terminal.nix +++ b/modules/packages/terminal.nix @@ -10,7 +10,7 @@ vim nano wget aria2 curl yt-dlp tree git autojump exa - nix-output-monitor + nix-output-monitor inputs.inputs.nix-alien.packages.x86_64-linux.nix-alien apacheHttpd certbot-full pigz rar unrar upx unzip zip util-linux snapper diff --git a/secrets/chn-nixos-test.yaml b/secrets/chn-nixos-test.yaml new file mode 100644 index 00000000..e69de29b