This commit is contained in:
Spectre 2024-06-07 22:43:09 +02:00
parent 0b97b828be
commit f185ce3c92
3 changed files with 96 additions and 43 deletions

View file

@ -33,38 +33,33 @@
stylix,
...
} @ inputs: let
inherit (self) outputs;
inherit (nixpkgs) lib;
hosts = builtins.filter (host: builtins.pathExists ./hosts/${host}/configuration.nix) (builtins.attrNames (builtins.readDir ./hosts));
mkHostConfig = host: let
defaultConf = rec {
hostname = host;
uid = 1000;
user = "lilith";
home = /home/${user};
tmpfsSize = "4G";
extraConfig = {};
};
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
];
};
hosts = builtins.filter (host: builtins.pathExists ./hosts/${host}/configuration.nix) (builtins.attrNames (builtins.readDir ./hosts));
importHostConf = host:
lib.recursiveUpdate defaultConf (import ./hosts/${host} inputs
// {
hostname = host;
hardware-configuration = ./hosts/${host}/hardware-configuration.nix;
});
mkHostConfig = host: import ./system (inputs // {conf = importHostConf host;});
in {
nixosConfigurations = builtins.listToAttrs (
map (host: {
name = host;
value = mkHostConfig host;
value = (mkHostConfig host).build;
})
hosts
);

28
system/base.nix Normal file
View file

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

View file

@ -1,5 +1,27 @@
{...}: {
imports = [
{
conf,
nixpkgs,
home-manager,
...
} @ inputs: let
inherit (conf) system;
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
@ -15,7 +37,15 @@
./stylix.nix
./wayland.nix
./zsh.nix
];
system.stateVersion = "24.11";
home-manager.nixosModules.home-manager
({config, ...}: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = specialArgs // {system-config = config;};
};
})
];
};
}