Refactor flake.nix

- unify pkg management
- pass system through the modules instead of hardcoding
This commit is contained in:
Tristan D. 2023-10-05 15:18:28 +02:00
parent d883041482
commit 698b862b74
Signed by: tristan
SSH key fingerprint: SHA256:U7y6eMb7CQDaTHv9XoX6/BaQnPqyxxKc+Xnfcefi6rY
5 changed files with 9 additions and 11 deletions

View file

@ -2,6 +2,7 @@
config, config,
pkgs, pkgs,
inputs, inputs,
system,
... ...
}: { }: {
imports = [ imports = [

View file

@ -65,10 +65,10 @@
allowUnfree = true; allowUnfree = true;
}; };
}; };
pkgs = inputs.nixpkgs.legacyPackages.${system}; pkgs = customPkgs;
in { in {
formatter = { formatter = {
x86_64-linux = inputs.nixpkgs.legacyPackages.x86_64-linux.alejandra; ${system} = pkgs.alejandra;
}; };
diskoConfigurations = { diskoConfigurations = {
nixos-pulse = import ./disko.nix; nixos-pulse = import ./disko.nix;
@ -81,14 +81,13 @@
modules = [ modules = [
./home.nix ./home.nix
{ {
_module.args.customPkgs = customPkgs; nixpkgs.pkgs = customPkgs;
} }
]; ];
}; };
}; };
nixosConfigurations = { nixosConfigurations = {
nixos-pulse = inputs.nixpkgs.lib.nixosSystem { nixos-pulse = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [ modules = [
./configuration.nix ./configuration.nix
./users.nix ./users.nix
@ -101,8 +100,8 @@
inputs.nur.nixosModules.nur inputs.nur.nixosModules.nur
inputs.tuxedo-nixos.nixosModules.default inputs.tuxedo-nixos.nixosModules.default
{ {
_module.args.customPkgs = customPkgs;
_module.args.inputs = inputs; _module.args.inputs = inputs;
_module.args.system = system;
nixpkgs.pkgs = customPkgs; nixpkgs.pkgs = customPkgs;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;

View file

@ -3,6 +3,7 @@
lib, lib,
pkgs, pkgs,
modulesPath, modulesPath,
system,
... ...
}: { }: {
imports = [ imports = [
@ -64,7 +65,7 @@
ACTION=="remove", KERNEL=="enp5s0f4u1u1c2", RUN+="${pkgs.systemd}/bin/systemctl stop network-addresses-enp5s0f4u1u1c2.service" 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 = { hardware = {
opengl = { opengl = {

View file

@ -1,6 +1,5 @@
{ {
pkgs, pkgs,
customPkgs,
config, config,
inputs, inputs,
... ...
@ -40,7 +39,7 @@ in {
services.emacs = { services.emacs = {
enable = true; enable = true;
defaultEditor = true; defaultEditor = true;
package = customPkgs.emacs-unstable-pgtk; package = pkgs.emacs-unstable-pgtk;
}; };
programs.nix-index = { programs.nix-index = {
@ -340,7 +339,7 @@ in {
brave brave
btop btop
cmake cmake
customPkgs.emacs-unstable-pgtk emacs-unstable-pgtk
firefox firefox
inkscape inkscape
jellyfin-media-player jellyfin-media-player

View file

@ -1,7 +1,6 @@
{ {
pkgs, pkgs,
config, config,
customPkgs,
inputs, inputs,
... ...
}: { }: {
@ -17,7 +16,6 @@
home-manager.users.tristand = import ./home.nix { home-manager.users.tristand = import ./home.nix {
inherit pkgs; inherit pkgs;
inherit config; inherit config;
inherit customPkgs;
inherit inputs; inherit inputs;
}; };
} }