repo: init

This commit is contained in:
Artur Manuel 2024-10-16 00:03:53 +01:00
commit 8dd5ce867a
6 changed files with 274 additions and 0 deletions

59
lib/default.nix Normal file
View file

@ -0,0 +1,59 @@
{inputs}: _: _: let
mkComputer = {
host,
system,
user,
extraModules ? [],
}:
inputs.nixpkgs.lib.nixosSystem {
inherit system;
modules =
extraModules
++ [
./computers/${host}
({config, ...}: {
config = {
nix = {
settings.extra-experimental-features = [
"nix-command"
"flakes"
];
gc = {
automatic = true;
dates = "weekly";
};
};
programs.fish = {
vendor = {
functions.enable = true;
config.enable = true;
completions.enable = true;
};
enable = true;
};
users = {
users.${user} = {
isNormalUser = true;
useDefaultShell = true;
initialPassword = "password";
extraGroups = ["wheel" "networkmanager" "video" "audio" "input" "libvirtd"];
name = user;
};
defaultUserShell = config.programs.fish.package;
};
environment.shellAliases = {
rebs = "nixos-rebuild --use-remote-sudo switch --flake .#${host}";
rebt = "nixos-rebuild --use-remote-sudo test --flake .#${host}";
};
networking.hostName = host;
};
})
];
specialArgs = {
inherit inputs;
inherit (inputs) self;
};
};
in {
mkComputers = computers: builtins.mapAttrs (n: v: mkComputer (v // {host = n;})) computers;
}