diff --git a/flake.nix b/flake.nix index ef07cb99..59c67ba6 100644 --- a/flake.nix +++ b/flake.nix @@ -33,38 +33,33 @@ stylix, ... } @ inputs: let - inherit (self) outputs; + inherit (nixpkgs) lib; + + defaultConf = rec { + uid = 1000; + user = "lilith"; + home = /home/${user}; + + tmpfsSize = "4G"; + + extraConfig = {}; + }; hosts = builtins.filter (host: builtins.pathExists ./hosts/${host}/configuration.nix) (builtins.attrNames (builtins.readDir ./hosts)); - mkHostConfig = host: let - defaultConf = rec { - hostname = host; + importHostConf = host: + lib.recursiveUpdate defaultConf (import ./hosts/${host} inputs + // { + hostname = host; + hardware-configuration = ./hosts/${host}/hardware-configuration.nix; + }); - uid = 1000; - user = "lilith"; - home = /home/${user}; - }; - in - nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs outputs; - conf = defaultConf; - }; - modules = [ - ./hosts/${host}/configuration.nix - ./hosts/${host}/hardware-configuration.nix - impermanence.nixosModule - home-manager.nixosModule - sops-nix.nixosModules.sops - stylix.nixosModules.stylix - ]; - }; + mkHostConfig = host: import ./system (inputs // {conf = importHostConf host;}); in { nixosConfigurations = builtins.listToAttrs ( map (host: { name = host; - value = mkHostConfig host; + value = (mkHostConfig host).build; }) hosts ); diff --git a/system/base.nix b/system/base.nix new file mode 100644 index 00000000..713d914d --- /dev/null +++ b/system/base.nix @@ -0,0 +1,28 @@ +{pkgs, ...}: { + boot.tmp.useTmpfs = true; + + time.timeZone = "Europe/Berlin"; + + environment.systemPackages = with pkgs; [ + age + compsize + duf + eza + file + htop + btop + jq + yq + du-dust + ranger + ripgrep + sops + wget + wireguard-tools + zip + ]; + + environment.pathsToLink = ["/share/zsh"]; + + system.stateVersion = "24.11"; +} diff --git a/system/default.nix b/system/default.nix index 17ad0292..c8c05787 100644 --- a/system/default.nix +++ b/system/default.nix @@ -1,21 +1,51 @@ -{...}: { - imports = [ - ./audio.nix - ./boot.nix - ./env.nix - ./networking.nix - ./persistence.nix - ./bluetooth.nix - ./btrfs.nix - ./fonts.nix - ./nix.nix - ./users.nix - ./ssh.nix - ./steam.nix - ./stylix.nix - ./wayland.nix - ./zsh.nix - ]; +{ + conf, + nixpkgs, + home-manager, + ... +} @ inputs: let + inherit (conf) system; - system.stateVersion = "24.11"; + pkgs = import nixpkgs { + inherit (conf) system; + config.allowUnfree = true; + }; + + specialArgs = inputs; +in { + build = nixpkgs.lib.nixosSystem { + inherit system pkgs specialArgs; + + modules = [ + ./base.nix + + conf.extraConfig + conf.hardware-configuration + + ./audio.nix + ./boot.nix + ./env.nix + ./networking.nix + ./persistence.nix + ./bluetooth.nix + ./btrfs.nix + ./fonts.nix + ./nix.nix + ./users.nix + ./ssh.nix + ./steam.nix + ./stylix.nix + ./wayland.nix + ./zsh.nix + + home-manager.nixosModules.home-manager + ({config, ...}: { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = specialArgs // {system-config = config;}; + }; + }) + ]; + }; }