From 698b862b744cddc18b588ac931990bb2d12c82f4 Mon Sep 17 00:00:00 2001 From: Tristan Druyen Date: Thu, 5 Oct 2023 15:18:28 +0200 Subject: [PATCH] Refactor flake.nix - unify pkg management - pass system through the modules instead of hardcoding --- configuration.nix | 1 + flake.nix | 9 ++++----- hardware.nix | 3 ++- home.nix | 5 ++--- users.nix | 2 -- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/configuration.nix b/configuration.nix index 8281383..ee79846 100644 --- a/configuration.nix +++ b/configuration.nix @@ -2,6 +2,7 @@ config, pkgs, inputs, + system, ... }: { imports = [ diff --git a/flake.nix b/flake.nix index 12eeaa9..8bdf11d 100644 --- a/flake.nix +++ b/flake.nix @@ -65,10 +65,10 @@ allowUnfree = true; }; }; - pkgs = inputs.nixpkgs.legacyPackages.${system}; + pkgs = customPkgs; in { formatter = { - x86_64-linux = inputs.nixpkgs.legacyPackages.x86_64-linux.alejandra; + ${system} = pkgs.alejandra; }; diskoConfigurations = { nixos-pulse = import ./disko.nix; @@ -81,14 +81,13 @@ modules = [ ./home.nix { - _module.args.customPkgs = customPkgs; + nixpkgs.pkgs = customPkgs; } ]; }; }; nixosConfigurations = { nixos-pulse = inputs.nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; modules = [ ./configuration.nix ./users.nix @@ -101,8 +100,8 @@ inputs.nur.nixosModules.nur inputs.tuxedo-nixos.nixosModules.default { - _module.args.customPkgs = customPkgs; _module.args.inputs = inputs; + _module.args.system = system; nixpkgs.pkgs = customPkgs; home-manager.useUserPackages = true; home-manager.useGlobalPkgs = true; diff --git a/hardware.nix b/hardware.nix index 2f76fe3..d8415ba 100644 --- a/hardware.nix +++ b/hardware.nix @@ -3,6 +3,7 @@ lib, pkgs, modulesPath, + system, ... }: { imports = [ @@ -64,7 +65,7 @@ ACTION=="remove", KERNEL=="enp5s0f4u1u1c2", RUN+="${pkgs.systemd}/bin/systemctl stop network-addresses-enp5s0f4u1u1c2.service" ''; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + nixpkgs.hostPlatform = lib.mkDefault system; hardware = { opengl = { diff --git a/home.nix b/home.nix index cca09e6..248c077 100644 --- a/home.nix +++ b/home.nix @@ -1,6 +1,5 @@ { pkgs, - customPkgs, config, inputs, ... @@ -40,7 +39,7 @@ in { services.emacs = { enable = true; defaultEditor = true; - package = customPkgs.emacs-unstable-pgtk; + package = pkgs.emacs-unstable-pgtk; }; programs.nix-index = { @@ -340,7 +339,7 @@ in { brave btop cmake - customPkgs.emacs-unstable-pgtk + emacs-unstable-pgtk firefox inkscape jellyfin-media-player diff --git a/users.nix b/users.nix index cc346a1..9bc03c7 100644 --- a/users.nix +++ b/users.nix @@ -1,7 +1,6 @@ { pkgs, config, - customPkgs, inputs, ... }: { @@ -17,7 +16,6 @@ home-manager.users.tristand = import ./home.nix { inherit pkgs; inherit config; - inherit customPkgs; inherit inputs; }; }