From 80d9e1029d8e2fc33b78837cf04cda048094c1fa Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 7 Aug 2025 20:50:18 -0700 Subject: [PATCH] refactor --- flake.nix | 37 +++++++++++++++++++------------------ hardware.nix | 1 - 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/flake.nix b/flake.nix index 4e75ea1..04ea249 100644 --- a/flake.nix +++ b/flake.nix @@ -62,6 +62,7 @@ username = "primary"; hostname = "muffin"; eth_interface = "enp4s0"; + system = "x86_64-linux"; service_configs = rec { zpool_ssds = "tank"; @@ -133,12 +134,17 @@ }; }; - pkgs = nixpkgs.legacyPackages.x86_64-linux; + pkgs = import nixpkgs { + inherit system; + hostPlatform = system; + buildPlatform = builtins.currentSystem; + }; lib = import ./lib.nix { inherit inputs pkgs; }; in { formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style; nixosConfigurations.${hostname} = nixpkgs.lib.nixosSystem { + inherit system; specialArgs = rec { inherit username @@ -154,19 +160,17 @@ ( { lib, ... }: { - config = { - assertions = [ - { - assertion = - let - ports = lib.attrValues service_configs.ports; - uniquePorts = lib.unique ports; - in - (lib.length ports) == (lib.length uniquePorts); - message = "Duplicate ports detected in 'ports' configuration"; - } - ]; - }; + config.assertions = [ + { + assertion = + let + ports = lib.attrValues service_configs.ports; + uniquePorts = lib.unique ports; + in + (lib.length ports) == (lib.length uniquePorts); + message = "Duplicate ports detected in 'ports' configuration"; + } + ]; } ) @@ -193,10 +197,7 @@ home-manager.nixosModules.home-manager ( { - pkgs, - username, home-manager, - stateVersion, ... }: { @@ -217,7 +218,7 @@ profiles.system = { sshUser = "root"; user = "root"; - path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.muffin; + path = deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations.muffin; }; }; diff --git a/hardware.nix b/hardware.nix index 16dc8b5..8978873 100644 --- a/hardware.nix +++ b/hardware.nix @@ -19,7 +19,6 @@ swapDevices = [ ]; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = true; hardware.enableRedistributableFirmware = true; }