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,
pkgs,
inputs,
system,
...
}: {
imports = [

View file

@ -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;

View file

@ -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 = {

View file

@ -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

View file

@ -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;
};
}