nixos configs refactor

This commit is contained in:
Ivan Kirilov Dimitrov 2024-08-02 19:47:54 +02:00
parent e1a429bdec
commit 1b2bbc3a31
No known key found for this signature in database
GPG Key ID: 0BDAD4B211C49294
2 changed files with 14 additions and 31 deletions

View File

@ -1,7 +1,7 @@
toplevel@{ inputs, withSystem, ... }: toplevel@{ inputs, withSystem, ... }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
nixosModules = toplevel.config.flake.nixosModules; mods = toplevel.config.flake.nixosModules;
hardwareConfigurations = { hardwareConfigurations = {
nova = { lib, modulesPath, ... }: { nova = { lib, modulesPath, ... }: {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
@ -24,37 +24,20 @@ let
hardware.cpu.intel.updateMicrocode = lib.mkForce false; hardware.cpu.intel.updateMicrocode = lib.mkForce false;
}; };
}; };
essential = [ hardwareConfigurations.nova inputs.hosts.nixosModule ] ++ (with nixosModules; [ grub base sound wayland security ivand wireless wireguard ]); essential = [ hardwareConfigurations.nova inputs.hosts.nixosModule ] ++ (with mods; [ grub base sound wayland security ivand wireless wireguard ]);
systemWithModules = modules: withSystem system (ctx@{ config, inputs', pkgs, ... }: inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs inputs' pkgs;
packages = config.packages;
};
modules = modules;
});
in in
{ {
flake.nixosConfigurations = { flake.nixosConfigurations = {
nixos = withSystem system (ctx@{ config, inputs', ... }: inputs.nixpkgs.lib.nixosSystem { nixos = systemWithModules essential;
specialArgs = { music = systemWithModules (essential ++ [ inputs.musnix.nixosModules.musnix mods.music ]);
inherit inputs inputs'; nonya = systemWithModules (essential ++ (with mods; [ anon cryptocurrency ]));
packages = config.packages; ai = systemWithModules (essential ++ (with mods; [ ai ]));
};
modules = essential;
});
music = withSystem system (ctx@{ config, inputs', ... }: inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs inputs';
packages = config.packages;
};
modules = essential ++ [ inputs.musnix.nixosModules.musnix nixosModules.music ];
});
nonya = withSystem system (ctx@{ config, inputs', ... }: inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs inputs';
packages = config.packages;
};
modules = essential ++ (with nixosModules; [ anon cryptocurrency ]);
});
ai = withSystem system (ctx@{ config, inputs', ... }: inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs inputs';
packages = config.packages;
};
modules = essential ++ [ nixosModules.ai ];
});
}; };
} }

View File

@ -18,7 +18,7 @@ top@{ moduleWithSystem, ... }: {
i18n.supportedLocales = [ "all" ]; i18n.supportedLocales = [ "all" ];
time.timeZone = "Europe/Prague"; time.timeZone = "Europe/Prague";
environment = { environment = {
systemPackages = with pkgs; [ wpd cmatrix uutils-coreutils-noprefix cryptsetup fd file git glibc gnumake mlocate openssh openssl procs ripgrep srm unzip vim zip just ]; systemPackages = with pkgs; [ cmatrix uutils-coreutils-noprefix cryptsetup fd file git glibc gnumake mlocate openssh openssl procs ripgrep srm unzip vim zip just ];
sessionVariables = { MAKEFLAGS = "-j 4"; }; sessionVariables = { MAKEFLAGS = "-j 4"; };
shells = with pkgs; [ bash zsh nushell ]; shells = with pkgs; [ bash zsh nushell ];
}; };