forked from fediversity/fediversity
		
	Compare commits
	
		
			6 commits
		
	
	
		
			37d11bc7d1
			...
			f5b8304475
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| f5b8304475 | |||
| ccc7d24bf0 | |||
| 4012f2b3a6 | |||
| f98301aacf | |||
| e47642ea5c | |||
| 6f58d38c45 | 
					 36 changed files with 111 additions and 278 deletions
				
			
		|  | @ -1,4 +1,5 @@ | |||
| { | ||||
|   pkgs, | ||||
|   runNixOSTest, | ||||
|   inputs, | ||||
|   sources, | ||||
|  | @ -9,7 +10,10 @@ runNixOSTest { | |||
|     ../common/nixosTest.nix | ||||
|     ./nixosTest.nix | ||||
|   ]; | ||||
|   _module.args = { inherit inputs sources; }; | ||||
|   _module.args = { | ||||
|     inherit inputs sources; | ||||
|     modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; | ||||
|   }; | ||||
|   inherit (import ./constants.nix) | ||||
|     targetMachines | ||||
|     pathToRoot | ||||
|  |  | |||
|  | @ -3,6 +3,7 @@ | |||
|   sources, | ||||
|   lib, | ||||
|   providers, | ||||
|   modulesPath, | ||||
|   ... | ||||
| }: | ||||
| 
 | ||||
|  | @ -23,7 +24,7 @@ in | |||
|       ../common/targetResource.nix | ||||
|     ]; | ||||
| 
 | ||||
|     _module.args = { inherit inputs sources; }; | ||||
|     _module.args = { inherit inputs sources modulesPath; }; | ||||
| 
 | ||||
|     inherit nodeName pathToRoot pathFromRoot; | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,7 +7,12 @@ | |||
|   outputs = | ||||
|     inputs: | ||||
|     import ./mkFlake.nix inputs ( | ||||
|       { inputs, sources, ... }: | ||||
|       { | ||||
|         inputs, | ||||
|         sources, | ||||
|         modulesPath, | ||||
|         ... | ||||
|       }: | ||||
|       { | ||||
|         imports = [ | ||||
|           inputs.nixops4.modules.flake.default | ||||
|  | @ -15,7 +20,7 @@ | |||
| 
 | ||||
|         nixops4Deployments.check-deployment-basic = { | ||||
|           imports = [ ./deployment/check/basic/deployment.nix ]; | ||||
|           _module.args = { inherit inputs sources; }; | ||||
|           _module.args = { inherit inputs sources modulesPath; }; | ||||
|         }; | ||||
|       } | ||||
|     ); | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| { | ||||
|   pkgs, | ||||
|   runNixOSTest, | ||||
|   inputs, | ||||
|   sources, | ||||
|  | @ -9,7 +10,10 @@ runNixOSTest { | |||
|     ../common/nixosTest.nix | ||||
|     ./nixosTest.nix | ||||
|   ]; | ||||
|   _module.args = { inherit inputs sources; }; | ||||
|   _module.args = { | ||||
|     inherit inputs sources; | ||||
|     modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; | ||||
|   }; | ||||
|   inherit (import ./constants.nix) | ||||
|     targetMachines | ||||
|     pathToRoot | ||||
|  |  | |||
|  | @ -2,6 +2,7 @@ | |||
|   inputs, | ||||
|   sources, | ||||
|   lib, | ||||
|   modulesPath, | ||||
| }: | ||||
| 
 | ||||
| let | ||||
|  | @ -15,7 +16,7 @@ let | |||
| 
 | ||||
|   makeTargetResource = nodeName: { | ||||
|     imports = [ ../common/targetResource.nix ]; | ||||
|     _module.args = { inherit inputs sources; }; | ||||
|     _module.args = { inherit inputs sources modulesPath; }; | ||||
|     inherit | ||||
|       nodeName | ||||
|       pathToRoot | ||||
|  |  | |||
|  | @ -11,6 +11,7 @@ | |||
|         inputs, | ||||
|         sources, | ||||
|         lib, | ||||
|         modulesPath, | ||||
|         ... | ||||
|       }: | ||||
|       { | ||||
|  | @ -19,7 +20,12 @@ | |||
|         ]; | ||||
| 
 | ||||
|         nixops4Deployments = import ./deployment/check/cli/deployments.nix { | ||||
|           inherit inputs sources lib; | ||||
|           inherit | ||||
|             inputs | ||||
|             sources | ||||
|             lib | ||||
|             modulesPath | ||||
|             ; | ||||
|         }; | ||||
|       } | ||||
|     ); | ||||
|  |  | |||
|  | @ -3,8 +3,8 @@ | |||
|   lib, | ||||
|   pkgs, | ||||
|   config, | ||||
|   sources, | ||||
|   modulesPath, | ||||
|   sources, | ||||
|   ... | ||||
| }: | ||||
| 
 | ||||
|  | @ -76,7 +76,6 @@ in | |||
|           machine = | ||||
|             (pkgs.nixos [ | ||||
|               ./targetNode.nix | ||||
|               # ../../../infra/common/nixos/repart.nix | ||||
|               "${modulesPath}/../lib/testing/nixos-test-base.nix" | ||||
|               config.system.extraDependenciesFromModule | ||||
|               { | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ | |||
|   config, | ||||
|   hostPkgs, | ||||
|   sources, | ||||
|   modulesPath, | ||||
|   ... | ||||
| }: | ||||
| 
 | ||||
|  | @ -78,6 +79,8 @@ in | |||
|       ./targetResource.nix | ||||
|     ]; | ||||
| 
 | ||||
|     acmeNodeIP = config.nodes.acme.networking.primaryIPAddress; | ||||
| 
 | ||||
|     nodes = lib.mkMerge [ | ||||
|       { | ||||
|         deployer = lib.mkMerge [ | ||||
|  | @ -86,7 +89,7 @@ in | |||
|             _module.args = { inherit inputs sources; }; | ||||
|             enableAcme = config.enableAcme; | ||||
|           } | ||||
|           (lib.mkIf config.enableAcme rec { | ||||
|           (lib.mkIf config.enableAcme { | ||||
|             acmeNodeIP = config.nodes.acme.networking.primaryIPAddress; | ||||
|             security.acme = { | ||||
|               acceptTerms = true; | ||||
|  | @ -96,7 +99,7 @@ in | |||
|             security.pki.certificateFiles = [ | ||||
|               (import "${inputs.nixpkgs}/nixos/tests/common/acme/server/snakeoil-certs.nix").ca.cert | ||||
|             ]; | ||||
|             networking.extraHosts = "${acmeNodeIP} acme.test"; | ||||
|             networking.extraHosts = "${config.acmeNodeIP} acme.test"; | ||||
|           }) | ||||
|         ]; | ||||
|       } | ||||
|  | @ -112,7 +115,7 @@ in | |||
|       (genAttrs config.targetMachines (_: { | ||||
|         imports = [ | ||||
|           ./targetNode.nix | ||||
|         ] ++ (lib.optional config.useFlake "${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix"); | ||||
|         ] ++ (lib.optional config.useFlake "${modulesPath}/../lib/testing/nixos-test-base.nix"); | ||||
|         _module.args = { inherit inputs sources; }; | ||||
|         enableAcme = config.enableAcme; | ||||
|         acmeNodeIP = if config.enableAcme then config.nodes.acme.networking.primaryIPAddress else null; | ||||
|  |  | |||
|  | @ -15,8 +15,8 @@ in | |||
|   _class = "nixos"; | ||||
| 
 | ||||
|   imports = [ | ||||
|     (modulesPath + "/profiles/minimal.nix") | ||||
|     (modulesPath + "/profiles/qemu-guest.nix") | ||||
|     "${modulesPath}/profiles/minimal.nix" | ||||
|     "${modulesPath}/profiles/qemu-guest.nix" | ||||
|     ./sharedOptions.nix | ||||
|   ]; | ||||
| 
 | ||||
|  |  | |||
|  | @ -40,7 +40,8 @@ in | |||
|       imports = [ | ||||
|         ./targetNode.nix | ||||
|         (lib.modules.importJSON (config.pathToCwd + "/${config.nodeName}-network.json")) | ||||
|       ] ++ (lib.optional config.useFlake "${modulesPath}/../lib/testing/nixos-test-base.nix"); | ||||
|         "${modulesPath}/../lib/testing/nixos-test-base.nix" | ||||
|       ]; | ||||
| 
 | ||||
|       _module.args = { inherit inputs sources; }; | ||||
|       enableAcme = config.enableAcme; | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| { | ||||
|   lib, | ||||
|   sources ? import ../../../npins, | ||||
|   modulesPath, | ||||
|   ... | ||||
| }: | ||||
| { | ||||
|  | @ -11,7 +11,7 @@ | |||
|       imports = [ | ||||
|         ../common/sharedOptions.nix | ||||
|         ../common/targetNode.nix | ||||
|         "${sources.nixpkgs}/nixos/modules/profiles/qemu-guest.nix" | ||||
|         "${modulesPath}/profiles/qemu-guest.nix" | ||||
|       ]; | ||||
| 
 | ||||
|       users.users = environment.config.resources."operator-environment".login-shell.apply { | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| { | ||||
|   config, | ||||
|   system, | ||||
|   modulesPath, | ||||
|   inputs, | ||||
|   sources ? import ../../../npins, | ||||
|   ... | ||||
|  | @ -9,7 +10,7 @@ let | |||
|   inherit (sources) nixpkgs; | ||||
|   pkgs = import nixpkgs { inherit system; }; | ||||
|   inherit (pkgs) lib; | ||||
|   inherit (pkgs.callPackage ../common/utils.nix { }) mkNixosConfiguration; | ||||
|   inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; | ||||
|   inherit (config) | ||||
|     nodeName | ||||
|     pathFromRoot | ||||
|  | @ -17,7 +18,7 @@ let | |||
|     ; | ||||
| in | ||||
| (pkgs.callPackage ../../utils.nix { inherit inputs; }).evalModel ( | ||||
|   { config, ... }: | ||||
|   { config, modulesPath, ... }: | ||||
|   { | ||||
|     imports = [ ../common/model.nix ]; | ||||
|     config = { | ||||
|  | @ -44,10 +45,10 @@ in | |||
|                   nixos.module = { | ||||
|                     imports = [ | ||||
|                       (mkNixosConfiguration environment required-resources) | ||||
|                       "${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix" | ||||
|                       "${modulesPath}/../lib/testing/nixos-test-base.nix" | ||||
|                     ]; | ||||
|                   }; | ||||
|                   _module.args = { inherit inputs sources; }; | ||||
|                   _module.args = { inherit inputs sources modulesPath; }; | ||||
|                   inherit nodeName pathToRoot pathFromRoot; | ||||
|                 }; | ||||
|               }; | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| { | ||||
|   pkgs, | ||||
|   runNixOSTest, | ||||
|   inputs, | ||||
|   sources, | ||||
|  | @ -11,7 +12,10 @@ runNixOSTest { | |||
|     ../common/nixosTest.nix | ||||
|     ./nixosTest.nix | ||||
|   ]; | ||||
|   _module.args = { inherit inputs sources; }; | ||||
|   _module.args = { | ||||
|     inherit inputs sources; | ||||
|     modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; | ||||
|   }; | ||||
|   inherit (import ./constants.nix) | ||||
|     targetMachines | ||||
|     pathToRoot | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
|   outputs = | ||||
|     inputs: | ||||
|     import ./mkFlake.nix inputs ( | ||||
|       { inputs, ... }: | ||||
|       { inputs, modulesPath, ... }: | ||||
|       let | ||||
|         system = "x86_64-linux"; | ||||
|       in | ||||
|  | @ -18,7 +18,7 @@ | |||
| 
 | ||||
|         nixops4Deployments.check-deployment-model = | ||||
|           (import ./deployment/check/data-model-nixops4/data-model.nix { | ||||
|             inherit system inputs; | ||||
|             inherit system inputs modulesPath; | ||||
|             config = { | ||||
|               inherit (import ./deployment/check/data-model-nixops4/constants.nix) pathToRoot pathFromRoot; | ||||
|               nodeName = "nixops4"; | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| { | ||||
|   config, | ||||
|   system, | ||||
|   modulesPath, | ||||
|   sources ? import ../../../npins, | ||||
|   ... | ||||
| }@args: | ||||
|  | @ -8,7 +9,7 @@ let | |||
|   inherit (sources) nixpkgs; | ||||
|   pkgs = import nixpkgs { inherit system; }; | ||||
|   inherit (pkgs) lib; | ||||
|   inherit (pkgs.callPackage ../common/utils.nix { }) mkNixosConfiguration; | ||||
|   inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; | ||||
|   inherit (config) | ||||
|     nodeName | ||||
|     pathToRoot | ||||
|  | @ -17,7 +18,7 @@ let | |||
|     ; | ||||
| in | ||||
| (pkgs.callPackage ../../utils.nix { }).evalModel ( | ||||
|   { config, ... }: | ||||
|   { config, modulesPath, ... }: | ||||
|   { | ||||
|     imports = [ ../common/model.nix ]; | ||||
|     config = { | ||||
|  | @ -34,7 +35,7 @@ in | |||
|               nixos-configuration = { | ||||
|                 imports = [ | ||||
|                   (mkNixosConfiguration environment required-resources) | ||||
|                   "${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix" | ||||
|                   "${modulesPath}/../lib/testing/nixos-test-base.nix" | ||||
|                 ]; | ||||
|               }; | ||||
|               system = targetSystem; | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| { | ||||
|   pkgs, | ||||
|   runNixOSTest, | ||||
|   inputs, | ||||
|   sources, | ||||
|  | @ -11,7 +12,10 @@ runNixOSTest { | |||
|     ../common/nixosTest.nix | ||||
|     ./nixosTest.nix | ||||
|   ]; | ||||
|   _module.args = { inherit inputs sources; }; | ||||
|   _module.args = { | ||||
|     inherit inputs sources; | ||||
|     modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; | ||||
|   }; | ||||
|   inherit (import ./constants.nix) | ||||
|     targetMachines | ||||
|     pathToRoot | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| { | ||||
|   lib, | ||||
|   pkgs, | ||||
|   modulesPath, | ||||
|   ... | ||||
| }: | ||||
| let | ||||
|  | @ -8,7 +9,7 @@ let | |||
|   nodeName = "ssh"; | ||||
|   deploy = | ||||
|     (import ./data-model.nix { | ||||
|       inherit system; | ||||
|       inherit system modulesPath; | ||||
|       config = { | ||||
|         inherit nodeName; | ||||
|         inherit (import ./constants.nix) pathToRoot; | ||||
|  |  | |||
|  | @ -42,7 +42,10 @@ pkgs.testers.runNixOSTest { | |||
|     ../common/nixosTest.nix | ||||
|     ./nixosTest.nix | ||||
|   ]; | ||||
|   _module.args = { inherit inputs sources; }; | ||||
|   _module.args = { | ||||
|     inherit inputs sources; | ||||
|     modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; | ||||
|   }; | ||||
|   inherit (import ./constants.nix) | ||||
|     targetMachines | ||||
|     pathToRoot | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| { | ||||
|   lib, | ||||
|   pkgs, | ||||
|   modulesPath, | ||||
|   sources, | ||||
|   ... | ||||
| }: | ||||
|  | @ -17,7 +18,7 @@ let | |||
|   # FIXME generate the image `nixos-generate` was to make, but now do it for a desired `-c configuration.nix` rather than whatever generic thing now | ||||
|   template-deployment = | ||||
|     (import ./setups/template.nix { | ||||
|       inherit sources system; | ||||
|       inherit sources system modulesPath; | ||||
|       config = { | ||||
|         httpBackend = tfBackend "proxmox-test/upload"; | ||||
|         nodeName = "pve"; | ||||
|  | @ -28,7 +29,7 @@ let | |||
|     }).default.tf-proxmox-template; | ||||
|   vm-deployment = | ||||
|     (import ./setups/vm.nix { | ||||
|       inherit sources system; | ||||
|       inherit sources system modulesPath; | ||||
|       config = { | ||||
|         httpBackend = tfBackend "proxmox-test/nixos"; | ||||
|         inherit (import ./constants.nix) pathToRoot; | ||||
|  |  | |||
|  | @ -5,9 +5,6 @@ | |||
| }: | ||||
| { | ||||
|   imports = [ | ||||
|     # systemd-repart | ||||
|     # ../../../../infra/common/nixos/repart.nix | ||||
|     # disko | ||||
|     "${sources.disko}/module.nix" | ||||
|     ../../../../infra/common/proxmox-qemu-vm.nix | ||||
|   ]; | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| { | ||||
|   config, | ||||
|   system, | ||||
|   modulesPath, | ||||
|   sources ? import ../../../../npins, | ||||
|   ... | ||||
| }: | ||||
|  | @ -8,7 +9,7 @@ let | |||
|   inherit (sources) nixpkgs; | ||||
|   pkgs = import nixpkgs { inherit system; }; | ||||
|   inherit (pkgs) lib; | ||||
|   inherit (pkgs.callPackage ../../common/utils.nix { inherit sources; }) mkNixosConfiguration; | ||||
|   inherit (pkgs.callPackage ../../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; | ||||
|   inherit (config) | ||||
|     nodeName | ||||
|     targetSystem | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| { | ||||
|   config, | ||||
|   system, | ||||
|   modulesPath, | ||||
|   sources ? import ../../../../npins, | ||||
|   ... | ||||
| }@args: | ||||
|  | @ -8,7 +9,7 @@ let | |||
|   inherit (sources) nixpkgs; | ||||
|   pkgs = import nixpkgs { inherit system; }; | ||||
|   inherit (pkgs) lib; | ||||
|   inherit (pkgs.callPackage ../../common/utils.nix { inherit sources; }) mkNixosConfiguration; | ||||
|   inherit (pkgs.callPackage ../../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; | ||||
|   inherit (config) | ||||
|     nodeName | ||||
|     pathToRoot | ||||
|  |  | |||
|  | @ -2,13 +2,14 @@ | |||
|   config, | ||||
|   system, | ||||
|   sources ? import ../../../npins, | ||||
|   modulesPath, | ||||
|   ... | ||||
| }@args: | ||||
| let | ||||
|   inherit (sources) nixpkgs; | ||||
|   pkgs = import nixpkgs { inherit system; }; | ||||
|   inherit (pkgs) lib; | ||||
|   inherit (pkgs.callPackage ../common/utils.nix { }) mkNixosConfiguration; | ||||
|   inherit (pkgs.callPackage ../common/utils.nix { inherit modulesPath; }) mkNixosConfiguration; | ||||
|   inherit (config) | ||||
|     nodeName | ||||
|     pathToRoot | ||||
|  | @ -18,7 +19,7 @@ let | |||
|     ; | ||||
| in | ||||
| (pkgs.callPackage ../../utils.nix { }).evalModel ( | ||||
|   { config, ... }: | ||||
|   { config, modulesPath, ... }: | ||||
|   { | ||||
|     imports = [ ../common/model.nix ]; | ||||
|     config = { | ||||
|  | @ -34,7 +35,7 @@ in | |||
|               nixos-configuration = { | ||||
|                 imports = [ | ||||
|                   (mkNixosConfiguration environment required-resources) | ||||
|                   "${sources.nixpkgs}/nixos/lib/testing/nixos-test-base.nix" | ||||
|                   "${modulesPath}/../lib/testing/nixos-test-base.nix" | ||||
|                 ]; | ||||
|               }; | ||||
|               system = targetSystem; | ||||
|  |  | |||
|  | @ -43,7 +43,10 @@ pkgs.testers.runNixOSTest { | |||
|     ../common/nixosTest.nix | ||||
|     ./nixosTest.nix | ||||
|   ]; | ||||
|   _module.args = { inherit inputs sources; }; | ||||
|   _module.args = { | ||||
|     inherit inputs sources; | ||||
|     modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; | ||||
|   }; | ||||
|   inherit (import ./constants.nix) | ||||
|     targetMachines | ||||
|     pathToRoot | ||||
|  |  | |||
|  | @ -2,6 +2,7 @@ | |||
|   lib, | ||||
|   pkgs, | ||||
|   sources, | ||||
|   modulesPath, | ||||
|   ... | ||||
| }: | ||||
| let | ||||
|  | @ -11,7 +12,7 @@ let | |||
|   backendPort = builtins.toString 8080; | ||||
|   deploy = | ||||
|     (import ./data-model.nix { | ||||
|       inherit system; | ||||
|       inherit system modulesPath; | ||||
|       config = { | ||||
|         inherit nodeName pathToRoot; | ||||
|         targetSystem = system; | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| { | ||||
|   pkgs, | ||||
|   runNixOSTest, | ||||
|   inputs, | ||||
|   sources, | ||||
|  | @ -9,7 +10,10 @@ runNixOSTest { | |||
|     ../common/nixosTest.nix | ||||
|     ./nixosTest.nix | ||||
|   ]; | ||||
|   _module.args = { inherit inputs sources; }; | ||||
|   _module.args = { | ||||
|     inherit inputs sources; | ||||
|     modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; | ||||
|   }; | ||||
|   inherit (import ./constants.nix) | ||||
|     targetMachines | ||||
|     pathToRoot | ||||
|  |  | |||
|  | @ -2,6 +2,7 @@ | |||
|   inputs, | ||||
|   sources, | ||||
|   lib, | ||||
|   modulesPath, | ||||
| }: | ||||
| 
 | ||||
| let | ||||
|  | @ -15,7 +16,7 @@ let | |||
| 
 | ||||
|   makeTargetResource = nodeName: { | ||||
|     imports = [ ../common/targetResource.nix ]; | ||||
|     _module.args = { inherit inputs sources; }; | ||||
|     _module.args = { inherit inputs sources modulesPath; }; | ||||
|     inherit | ||||
|       nodeName | ||||
|       pathToRoot | ||||
|  |  | |||
|  | @ -11,6 +11,7 @@ | |||
|         inputs, | ||||
|         sources, | ||||
|         lib, | ||||
|         modulesPath, | ||||
|         ... | ||||
|       }: | ||||
|       { | ||||
|  | @ -19,7 +20,12 @@ | |||
|         ]; | ||||
| 
 | ||||
|         nixops4Deployments.check-deployment-panel = import ./deployment/check/panel/deployment.nix { | ||||
|           inherit inputs sources lib; | ||||
|           inherit | ||||
|             inputs | ||||
|             sources | ||||
|             lib | ||||
|             modulesPath | ||||
|             ; | ||||
|         }; | ||||
|       } | ||||
|     ); | ||||
|  |  | |||
|  | @ -30,6 +30,7 @@ runNixOSTest { | |||
|       sources | ||||
|       pkgs | ||||
|       ; | ||||
|     modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; | ||||
|   }; | ||||
|   imports = [ | ||||
|     ./proxmoxTest.nix | ||||
|  |  | |||
|  | @ -328,43 +328,15 @@ let | |||
|                 inherit (ssh) | ||||
|                   host | ||||
|                   ; | ||||
|                 # machine = import nixos_conf; | ||||
|                 machine = import ./nixos.nix { | ||||
|                   inherit sources system; | ||||
|                   configuration = tf-host.config.nixos-configuration; | ||||
|                   # configuration = { ... }: { | ||||
|                   #   imports = [ | ||||
|                   #     tf-host.config.nixos-configuration | ||||
|                   #     ../infra/common/nixos/repart.nix | ||||
|                   #   ]; | ||||
|                   # }; | ||||
|                 }; | ||||
|                 # inherit (machine.config.boot.uki) name; | ||||
|                 name = "monkey"; | ||||
| 
 | ||||
|                 # # systemd-repart | ||||
|                 # better for cross-compilation, worse for pre-/post-processing, doesn't support MBR: https://github.com/nix-community/disko/issues/550#issuecomment-2503736973 | ||||
|                 # raw = "${machine.config.system.build.image}/${name}.raw"; | ||||
| 
 | ||||
|                 # disko | ||||
|                 # worse for cross-compilation, better for pre-/post-processing, needs manual `imageSize`, random failures: https://github.com/nix-community/disko/issues/550#issuecomment-2503736973 | ||||
|                 raw = "${machine.config.system.build.diskoImages}/main.raw"; | ||||
| 
 | ||||
|                 # # nixos-generators: note it can straight-up do qcow2 as well, if we settle for nixos-generators | ||||
|                 # # `mount: /run/nixos-etc-metadata.J3iARWBtna: failed to setup loop device for /nix/store/14ka2bmx6lcnyr8ah2yl787sqcgxz5ni-etc-metadata.erofs.` | ||||
|                 # # [`Error: Failed to parse os-release`](https://github.com/NixOS/nixpkgs/blob/5b1861820a3bc4ef2f60b0afcffb71ea43f5d000/pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs#L151) | ||||
|                 # raw = let | ||||
|                 # # TODO parameterize things to let this flow into the terraform | ||||
|                 # # btw qcow can be made by nixos-generators (qcow, qcow-efi) or by `image.repart` | ||||
|                 # # wait, so i generate an image for the nixos config from the data model? how would i then propagate that to deploy? | ||||
|                 # gen = import "${pkgs.nixos-generators}/share/nixos-generator/nixos-generate.nix" { | ||||
|                 #   inherit system formatConfig; | ||||
|                 #   inherit (sources) nixpkgs; | ||||
|                 #   configuration = tf-host.config.nixos-configuration; | ||||
|                 # }; | ||||
|                 # in | ||||
|                 #   "${gen.config.system.build.${formatAttr}}/nixos${fileExtension}"; | ||||
| 
 | ||||
|                 environment = { | ||||
|                   inherit | ||||
|                     host | ||||
|  | @ -384,8 +356,6 @@ let | |||
|                 (withPackages [ | ||||
|                   pkgs.jq | ||||
|                   pkgs.qemu | ||||
|                   pkgs.nixos-generators | ||||
|                   pkgs.httpie | ||||
|                   (pkgs.callPackage ./run/tf-proxmox-vm/tf.nix { }) | ||||
|                 ]) | ||||
|                 '' | ||||
|  | @ -573,8 +543,6 @@ let | |||
|                 (withPackages [ | ||||
|                   pkgs.jq | ||||
|                   pkgs.qemu | ||||
|                   pkgs.nixos-generators | ||||
|                   pkgs.httpie | ||||
|                   (pkgs.callPackage ./run/tf-proxmox-vm/tf.nix { }) | ||||
|                 ]) | ||||
|                 '' | ||||
|  |  | |||
|  | @ -14,27 +14,27 @@ | |||
| 
 | ||||
|         deployment-basic = import ./check/basic { | ||||
|           inherit (pkgs.testers) runNixOSTest; | ||||
|           inherit inputs sources; | ||||
|           inherit pkgs inputs sources; | ||||
|         }; | ||||
| 
 | ||||
|         deployment-cli = import ./check/cli { | ||||
|           inherit (pkgs.testers) runNixOSTest; | ||||
|           inherit inputs sources; | ||||
|           inherit pkgs inputs sources; | ||||
|         }; | ||||
| 
 | ||||
|         deployment-panel = import ./check/panel { | ||||
|           inherit (pkgs.testers) runNixOSTest; | ||||
|           inherit inputs sources; | ||||
|           inherit pkgs inputs sources; | ||||
|         }; | ||||
| 
 | ||||
|         deployment-model-ssh = import ./check/data-model-ssh { | ||||
|           inherit (pkgs.testers) runNixOSTest; | ||||
|           inherit inputs sources; | ||||
|           inherit pkgs inputs sources; | ||||
|         }; | ||||
| 
 | ||||
|         deployment-model-nixops4 = import ./check/data-model-nixops4 { | ||||
|           inherit (pkgs.testers) runNixOSTest; | ||||
|           inherit inputs sources; | ||||
|           inherit pkgs inputs sources; | ||||
|         }; | ||||
| 
 | ||||
|         deployment-model-tf = import ./check/data-model-tf { | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ | |||
|     (lib.evalModules { | ||||
|       specialArgs = { | ||||
|         inherit pkgs inputs; | ||||
|         modulesPath = "${builtins.toString pkgs.path}/nixos/modules"; | ||||
|       }; | ||||
|       modules = [ | ||||
|         ./data-model.nix | ||||
|  |  | |||
|  | @ -10,7 +10,6 @@ in | |||
|   imports = [ | ||||
|     ./networking.nix | ||||
|     ./users.nix | ||||
|     # ./repart.nix | ||||
|   ]; | ||||
| 
 | ||||
|   time.timeZone = "Europe/Amsterdam"; | ||||
|  |  | |||
|  | @ -1,192 +0,0 @@ | |||
| { | ||||
|   config, | ||||
|   pkgs, | ||||
|   lib, | ||||
|   modulesPath, | ||||
|   ... | ||||
| }: | ||||
| { | ||||
| 
 | ||||
|   imports = [ | ||||
|     "${modulesPath}/image/repart.nix" | ||||
|   ]; | ||||
| 
 | ||||
|   fileSystems = { | ||||
|     # "/" = { | ||||
|     #   fsType = "tmpfs"; | ||||
|     #   options = [ | ||||
|     #     "size=20%" | ||||
|     #   ]; | ||||
|     # }; | ||||
|     "/" = | ||||
|       let | ||||
|         partConf = config.image.repart.partitions."root".repartConfig; | ||||
|       in | ||||
|       { | ||||
|         device = "/dev/disk/by-partuuid/${partConf.UUID}"; | ||||
|         fsType = partConf.Format; | ||||
|       }; | ||||
| 
 | ||||
|     # "/var" = | ||||
|     #   let | ||||
|     #     partConf = config.image.repart.partitions."var".repartConfig; | ||||
|     #   in | ||||
|     #   { | ||||
|     #     device = "/dev/disk/by-partuuid/${partConf.UUID}"; | ||||
|     #     fsType = partConf.Format; | ||||
|     #   }; | ||||
| 
 | ||||
|     "/boot" = | ||||
|       let | ||||
|         partConf = config.image.repart.partitions."esp".repartConfig; | ||||
|       in | ||||
|       { | ||||
|         device = "/dev/disk/by-partuuid/${partConf.UUID}"; | ||||
|         fsType = partConf.Format; | ||||
|       }; | ||||
| 
 | ||||
|     # "/nix/store" = | ||||
|     #   let | ||||
|     #     partConf = config.image.repart.partitions."store".repartConfig; | ||||
|     #   in | ||||
|     #   { | ||||
|     #     device = "/dev/disk/by-partlabel/${partConf.Label}"; | ||||
|     #     fsType = partConf.Format; | ||||
|     #   }; | ||||
|   }; | ||||
| 
 | ||||
|   boot.uki.name = "monkey"; | ||||
|   # fileSystems."/".device = "/dev/disk/by-label/nixos"; | ||||
|   # https://nixos.org/manual/nixos/stable/#sec-image-repart | ||||
|   # https://x86.lol/generic/2024/08/28/systemd-sysupdate.html | ||||
|   image.repart = | ||||
|     let | ||||
|       efiArch = pkgs.stdenv.hostPlatform.efiArch; | ||||
|     in | ||||
|     { | ||||
|       name = config.boot.uki.name; | ||||
|       # name = "image"; | ||||
|       # split = true; | ||||
|       partitions = { | ||||
|         "esp" = { | ||||
|           # The contents to end up in the filesystem image. | ||||
|           contents = { | ||||
|             # "/EFI/BOOT/BOOTX64.EFI".source = "${pkgs.systemd}/lib/systemd/boot/efi/systemd-bootx64.efi"; | ||||
|             "/EFI/BOOT/BOOT${lib.toUpper efiArch}.EFI".source = | ||||
|               "${pkgs.systemd}/lib/systemd/boot/efi/systemd-boot${efiArch}.efi"; | ||||
| 
 | ||||
|             "/EFI/Linux/${config.system.boot.loader.ukiFile}".source = | ||||
|               "${config.system.build.uki}/${config.system.boot.loader.ukiFile}"; | ||||
| 
 | ||||
|             # https://man.archlinux.org/man/loader.conf.5 | ||||
|             "/loader/entries/loader.conf".source = pkgs.writeText "loader.conf" '' | ||||
|               timeout 0 | ||||
|               editor yes | ||||
|               default * | ||||
|               logLevel=debug | ||||
|             ''; | ||||
|             # "/loader/loader.conf".source = pkgs.writeText "loader.conf" '' | ||||
|             #   timeout 0 | ||||
|             #   editor yes | ||||
|             #   default * | ||||
|             #   logLevel=debug | ||||
|             # ''; | ||||
|             # nixos-*.conf | ||||
|             # "/loader/entries/nixos.conf".source = pkgs.writeText "nixos.conf" '' | ||||
|             #   title NixOS | ||||
|             #   linux /EFI/nixos/kernel.efi | ||||
|             #   initrd /EFI/nixos/initrd.efi | ||||
|             #   options init=/nix/store/.../init root=LABEL=nixos | ||||
|             # ''; | ||||
| 
 | ||||
|             # systemd-boot configuration | ||||
|             "/loader/loader.conf".source = ( | ||||
|               pkgs.writeText "$out" '' | ||||
|                 timeout 3 | ||||
|               '' | ||||
|             ); | ||||
|           }; | ||||
|           # https://www.man7.org/linux//man-pages/man5/repart.d.5.html | ||||
|           repartConfig = { | ||||
|             Priority = 1; | ||||
|             Type = "esp"; | ||||
|             MountPoint = "/boot"; | ||||
|             Format = "vfat"; | ||||
|             UUID = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"; | ||||
|             SizeMinBytes = "500M"; | ||||
|             SizeMaxBytes = "500M"; | ||||
|           }; | ||||
|           # repartConfig = { | ||||
|           #   Type = "esp"; | ||||
|           #   UUID = "c12a7328-f81f-11d2-ba4b-00a0c93ec93b"; # Well known | ||||
|           #   Format = "vfat"; | ||||
|           #   SizeMinBytes = "256M"; | ||||
|           #   SplitName = "-"; | ||||
|           # }; | ||||
|         }; | ||||
|         "root" = { | ||||
|           storePaths = [ config.system.build.toplevel ]; | ||||
|           repartConfig = { | ||||
|             Priority = 2; | ||||
|             Type = "root"; | ||||
|             Label = "nixos"; | ||||
|             MountPoint = "/"; | ||||
|             Format = "ext4"; | ||||
|             UUID = "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"; | ||||
|             # populates the fs twice | ||||
|             Minimize = "guess"; | ||||
|             # Minimize = "off"; | ||||
|             # SizeMinBytes = "1G"; | ||||
|             # SizeMaxBytes = "20G"; | ||||
|           }; | ||||
| 
 | ||||
|           # "store" = { | ||||
|           #   storePaths = [ config.system.build.toplevel ]; | ||||
|           #   stripNixStorePrefix = true; | ||||
|           #   repartConfig = { | ||||
|           #     Type = "linux-generic"; | ||||
|           #     Label = "store_${config.system.image.version}"; | ||||
|           #     Format = "squashfs"; | ||||
|           #     Minimize = "off"; | ||||
|           #     ReadOnly = "yes"; | ||||
| 
 | ||||
|           #     SizeMinBytes = "1G"; | ||||
|           #     SizeMaxBytes = "1G"; | ||||
|           #     SplitName = "store"; | ||||
|           #   }; | ||||
|           # }; | ||||
| 
 | ||||
|           # # Placeholder for the second installed Nix store. | ||||
|           # "store-empty" = { | ||||
|           #   repartConfig = { | ||||
|           #     Type = "linux-generic"; | ||||
|           #     Label = "_empty"; | ||||
|           #     Minimize = "off"; | ||||
|           #     SizeMinBytes = "1G"; | ||||
|           #     SizeMaxBytes = "1G"; | ||||
|           #     SplitName = "-"; | ||||
|           #   }; | ||||
|           # }; | ||||
| 
 | ||||
|           # # Persistent storage | ||||
|           # "var" = { | ||||
|           #   repartConfig = { | ||||
|           #     Type = "var"; | ||||
|           #     UUID = "4d21b016-b534-45c2-a9fb-5c16e091fd2d"; # Well known | ||||
|           #     Format = "xfs"; | ||||
|           #     Label = "nixos-persistent"; | ||||
|           #     Minimize = "off"; | ||||
| 
 | ||||
|           #     # Has to be large enough to hold update files. | ||||
|           #     SizeMinBytes = "2G"; | ||||
|           #     SizeMaxBytes = "2G"; | ||||
|           #     SplitName = "-"; | ||||
| 
 | ||||
|           #     # Wiping this gives us a clean state. | ||||
|           #     FactoryReset = "yes"; | ||||
|           #   }; | ||||
|           # }; | ||||
|         }; | ||||
|       }; | ||||
|     }; | ||||
| } | ||||
|  | @ -30,13 +30,13 @@ | |||
|       type = "gpt"; | ||||
| 
 | ||||
|       partitions = { | ||||
|         mbr = { | ||||
|         MBR = { | ||||
|           priority = 0; | ||||
|           size = "1M"; | ||||
|           type = "EF02"; | ||||
|         }; | ||||
| 
 | ||||
|         esp = { | ||||
|         ESP = { | ||||
|           priority = 1; | ||||
|           size = "500M"; | ||||
|           type = "EF00"; | ||||
|  |  | |||
|  | @ -26,7 +26,8 @@ let | |||
|     inputs = inputs'; | ||||
|   }; | ||||
| 
 | ||||
|   flake-parts-lib = import "${sources.flake-parts}/lib.nix" { inherit (nixpkgs) lib; }; | ||||
|   inherit (nixpkgs) lib outPath; | ||||
|   flake-parts-lib = import "${sources.flake-parts}/lib.nix" { inherit lib; }; | ||||
| in | ||||
| 
 | ||||
| flakeModule: | ||||
|  | @ -41,6 +42,7 @@ flake-parts-lib.mkFlake | |||
|     self = self'; | ||||
|     specialArgs = { | ||||
|       inherit sources; | ||||
|       modulesPath = "${builtins.toString outPath}/nixos/modules"; | ||||
|     }; | ||||
|   } | ||||
|   { | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue