created mkHost and mkHomeConfiguration
This commit is contained in:
parent
1f9812fea0
commit
d51f6f14db
8 changed files with 178 additions and 191 deletions
|
|
@ -1,4 +1,9 @@
|
||||||
{ lib, config, ... }:
|
{
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
# Host submodule type
|
# Host submodule type
|
||||||
|
|
@ -132,6 +137,81 @@ in
|
||||||
local-data = lanData;
|
local-data = lanData;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
# Generates flake.homeConfigurations
|
||||||
|
mkHomeConfiguration =
|
||||||
|
{
|
||||||
|
user,
|
||||||
|
hostname,
|
||||||
|
system ? "x86_64-linux",
|
||||||
|
stateVersion ? "22.05",
|
||||||
|
nixpkgs ? inputs.nixpkgs, # override with e.g. inputs.nixpkgs-stable
|
||||||
|
userModules ? [ ],
|
||||||
|
overlays ? [ inputs.self.overlays.default ],
|
||||||
|
homeManagerModules ? with inputs.self.modules.homeManager; [
|
||||||
|
base
|
||||||
|
cli
|
||||||
|
],
|
||||||
|
userDirectory ? "/home/${user}",
|
||||||
|
}:
|
||||||
|
inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
|
||||||
|
extraSpecialArgs = {
|
||||||
|
inherit inputs hostname;
|
||||||
|
};
|
||||||
|
|
||||||
|
modules = [
|
||||||
|
{ nixpkgs.overlays = overlays; }
|
||||||
|
{
|
||||||
|
home = {
|
||||||
|
username = user;
|
||||||
|
homeDirectory = userDirectory;
|
||||||
|
inherit stateVersion;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p))
|
||||||
|
"/${inputs.self}/aspects/users/_${user}"
|
||||||
|
)
|
||||||
|
]
|
||||||
|
++ homeManagerModules
|
||||||
|
++ userModules;
|
||||||
|
};
|
||||||
|
# Generates flake.nixosConfigurations
|
||||||
|
mkHost =
|
||||||
|
{
|
||||||
|
hostname,
|
||||||
|
system ? "x86_64-linux",
|
||||||
|
nixpkgs ? inputs.nixpkgs,
|
||||||
|
overlays ? [
|
||||||
|
inputs.agenix.overlays.default
|
||||||
|
inputs.self.overlays.default
|
||||||
|
],
|
||||||
|
ephemeralRootDev ? null, # pass rootDevice string to enable, e.g. ephemeralephemeralRootDev = "/dev/mapper/cryptroot"
|
||||||
|
nixosModules ? with inputs.self.modules.nixos; [
|
||||||
|
base
|
||||||
|
cli
|
||||||
|
user
|
||||||
|
root
|
||||||
|
],
|
||||||
|
extraModules ? [ ],
|
||||||
|
}:
|
||||||
|
nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
specialArgs = { inherit inputs; };
|
||||||
|
modules = [
|
||||||
|
inputs.agenix.nixosModules.default
|
||||||
|
{ networking.hostName = hostname; }
|
||||||
|
{ nixpkgs.overlays = overlays; }
|
||||||
|
((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p))
|
||||||
|
"${inputs.self}/aspects/hosts/_${hostname}"
|
||||||
|
)
|
||||||
|
]
|
||||||
|
++ (lib.optional (ephemeralRootDev != null) (
|
||||||
|
inputs.self.factory.ephemeral { rootDevice = ephemeralRootDev; }
|
||||||
|
))
|
||||||
|
++ nixosModules
|
||||||
|
++ extraModules;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,19 @@
|
||||||
{ inputs, lib, ... }:
|
{ inputs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
mkHost = inputs.self.lib.mkHost;
|
||||||
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
flake.nixosConfigurations.alexandria = inputs.nixpkgs-stable.lib.nixosSystem {
|
flake.nixosConfigurations.alexandria = mkHost {
|
||||||
system = "x86_64-linux";
|
hostname = "alexandria";
|
||||||
specialArgs = { inherit inputs; };
|
nixpkgs = inputs.nixpkgs-stable;
|
||||||
modules = [
|
extraModules = with inputs.self.modules.nixos; [
|
||||||
inputs.agenix.nixosModules.default
|
# base aspects
|
||||||
{ networking.hostName = "alexandria"; }
|
|
||||||
{
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
inputs.agenix.overlays.default
|
|
||||||
inputs.self.overlays.default
|
|
||||||
];
|
|
||||||
}
|
|
||||||
((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) ./_alexandria)
|
|
||||||
]
|
|
||||||
++ (with inputs.self.modules.nixos; [
|
|
||||||
# system aspects
|
|
||||||
base
|
|
||||||
cli
|
|
||||||
server
|
server
|
||||||
|
|
||||||
# user aspects
|
|
||||||
user
|
|
||||||
root
|
|
||||||
|
|
||||||
# other aspects
|
# other aspects
|
||||||
fwupd
|
fwupd
|
||||||
libvirtd
|
libvirtd
|
||||||
]);
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,17 @@
|
||||||
{ inputs, lib, ... }:
|
{ inputs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
mkHost = inputs.self.lib.mkHost;
|
||||||
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
flake.nixosConfigurations.io = inputs.nixpkgs.lib.nixosSystem {
|
flake.nixosConfigurations.io = mkHost {
|
||||||
system = "x86_64-linux";
|
hostname = "io";
|
||||||
specialArgs = { inherit inputs; };
|
ephemeralRootDev = "/dev/mapper/cryptroot";
|
||||||
modules = [
|
extraModules = with inputs.self.modules.nixos; [
|
||||||
inputs.agenix.nixosModules.default
|
# base aspects
|
||||||
{ networking.hostName = "io"; }
|
|
||||||
{
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
inputs.agenix.overlays.default
|
|
||||||
inputs.self.overlays.default
|
|
||||||
];
|
|
||||||
}
|
|
||||||
((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) ./_io)
|
|
||||||
(inputs.self.factory.ephemeral {
|
|
||||||
rootDevice = "/dev/mapper/cryptroot";
|
|
||||||
})
|
|
||||||
]
|
|
||||||
++ (with inputs.self.modules.nixos; [
|
|
||||||
# system aspects
|
|
||||||
base
|
|
||||||
cli
|
|
||||||
desktop
|
desktop
|
||||||
|
# other aspects
|
||||||
# user aspects
|
|
||||||
user
|
|
||||||
root
|
|
||||||
|
|
||||||
# Other aspects
|
|
||||||
ai
|
ai
|
||||||
bluetooth
|
bluetooth
|
||||||
dev
|
dev
|
||||||
|
|
@ -36,6 +19,6 @@
|
||||||
networkmanager
|
networkmanager
|
||||||
niri
|
niri
|
||||||
podman
|
podman
|
||||||
]);
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,17 @@
|
||||||
{ inputs, lib, ... }:
|
{ inputs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
mkHost = inputs.self.lib.mkHost;
|
||||||
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
flake.nixosConfigurations.rotterdam = inputs.nixpkgs.lib.nixosSystem {
|
flake.nixosConfigurations.rotterdam = mkHost {
|
||||||
system = "x86_64-linux";
|
hostname = "rotterdam";
|
||||||
specialArgs = { inherit inputs; };
|
ephemeralRootDev = "/dev/mapper/cryptroot";
|
||||||
modules = [
|
extraModules = with inputs.self.modules.nixos; [
|
||||||
inputs.agenix.nixosModules.default
|
# base aspects
|
||||||
{ networking.hostName = "rotterdam"; }
|
|
||||||
{
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
inputs.agenix.overlays.default
|
|
||||||
inputs.self.overlays.default
|
|
||||||
];
|
|
||||||
}
|
|
||||||
((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) ./_rotterdam)
|
|
||||||
(inputs.self.factory.ephemeral {
|
|
||||||
rootDevice = "/dev/mapper/cryptroot";
|
|
||||||
})
|
|
||||||
]
|
|
||||||
++ (with inputs.self.modules.nixos; [
|
|
||||||
# system aspects
|
|
||||||
base
|
|
||||||
cli
|
|
||||||
desktop
|
desktop
|
||||||
gaming
|
gaming
|
||||||
|
|
||||||
# user aspects
|
|
||||||
user
|
|
||||||
root
|
|
||||||
|
|
||||||
# other aspects
|
# other aspects
|
||||||
ai
|
ai
|
||||||
bluetooth
|
bluetooth
|
||||||
|
|
@ -38,6 +21,6 @@
|
||||||
networkmanager
|
networkmanager
|
||||||
niri
|
niri
|
||||||
podman
|
podman
|
||||||
]);
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,18 @@
|
||||||
{ inputs, lib, ... }:
|
{ inputs, ... }:
|
||||||
{
|
|
||||||
flake.nixosConfigurations.trantor = inputs.nixpkgs-stable.lib.nixosSystem {
|
|
||||||
system = "aarch64-linux";
|
|
||||||
specialArgs = { inherit inputs; };
|
|
||||||
modules = [
|
|
||||||
inputs.agenix.nixosModules.default
|
|
||||||
{ networking.hostName = "trantor"; }
|
|
||||||
{
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
inputs.agenix.overlays.default
|
|
||||||
inputs.self.overlays.default
|
|
||||||
];
|
|
||||||
}
|
|
||||||
((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) ./_trantor)
|
|
||||||
(inputs.self.factory.ephemeral {
|
|
||||||
rootDevice = "/dev/disk/by-id/scsi-360b207ed25d84372a95d1ecf842f8e20-part2";
|
|
||||||
})
|
|
||||||
]
|
|
||||||
++ (with inputs.self.modules.nixos; [
|
|
||||||
# system aspects
|
|
||||||
base
|
|
||||||
cli
|
|
||||||
server
|
|
||||||
|
|
||||||
# user aspects
|
let
|
||||||
user
|
mkHost = inputs.self.lib.mkHost;
|
||||||
root
|
in
|
||||||
]);
|
|
||||||
|
{
|
||||||
|
flake.nixosConfigurations.trantor = mkHost {
|
||||||
|
hostname = "trantor";
|
||||||
|
system = "aarch64-linux";
|
||||||
|
nixpkgs = inputs.nixpkgs-stable;
|
||||||
|
ephemeralRootDev = "/dev/disk/by-id/scsi-360b207ed25d84372a95d1ecf842f8e20-part2";
|
||||||
|
extraModules = with inputs.self.modules.nixos; [
|
||||||
|
# base aspects
|
||||||
|
server
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
{ ... }:
|
{ inputs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
mkHomeConfiguration = inputs.self.lib.mkHomeConfiguration;
|
||||||
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
flake.modules.nixos.user =
|
flake = {
|
||||||
|
modules.nixos.user =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
users.users.user = {
|
users.users.user = {
|
||||||
|
|
@ -19,4 +24,32 @@
|
||||||
hashedPassword = "$6$Pj7v/CpstyuWQQV0$cNujVDhfMBdwlGVEnnd8t71.kZPixbo0u25cd.874iaqLTH4V5fa1f98V5zGapjQCz5JyZmsR94xi00sUrntT0";
|
hashedPassword = "$6$Pj7v/CpstyuWQQV0$cNujVDhfMBdwlGVEnnd8t71.kZPixbo0u25cd.874iaqLTH4V5fa1f98V5zGapjQCz5JyZmsR94xi00sUrntT0";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
homeConfigurations = {
|
||||||
|
"user@rotterdam" = mkHomeConfiguration {
|
||||||
|
user = "user";
|
||||||
|
hostname = "rotterdam";
|
||||||
|
userModules = with inputs.self.modules.homeManager; [
|
||||||
|
# system aspects
|
||||||
|
desktop
|
||||||
|
gaming
|
||||||
|
|
||||||
|
# other aspects
|
||||||
|
stylix
|
||||||
|
niri
|
||||||
|
];
|
||||||
|
};
|
||||||
|
"user@io" = mkHomeConfiguration {
|
||||||
|
user = "user";
|
||||||
|
hostname = "io";
|
||||||
|
userModules = with inputs.self.modules.homeManager; [
|
||||||
|
# system aspects
|
||||||
|
desktop
|
||||||
|
|
||||||
|
# other aspects
|
||||||
|
stylix
|
||||||
|
niri
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
{ inputs, lib, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
flake.homeConfigurations."user@io" = {
|
|
||||||
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
|
|
||||||
extraSpecialArgs = {
|
|
||||||
inherit inputs;
|
|
||||||
hostname = "io";
|
|
||||||
};
|
|
||||||
modules = [
|
|
||||||
{ nixpkgs.overlays = [ inputs.self.overlays.default ]; }
|
|
||||||
{
|
|
||||||
home = {
|
|
||||||
username = "user";
|
|
||||||
homeDirectory = "/home/user";
|
|
||||||
stateVersion = "22.05";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) ./_user)
|
|
||||||
]
|
|
||||||
++ (with inputs.self.modules.homeManager; [
|
|
||||||
# system aspects
|
|
||||||
base
|
|
||||||
cli
|
|
||||||
desktop
|
|
||||||
|
|
||||||
# other aspects
|
|
||||||
stylix
|
|
||||||
niri
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
{ inputs, lib, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
flake.homeConfigurations."user@rotterdam" = {
|
|
||||||
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
|
|
||||||
extraSpecialArgs = {
|
|
||||||
inherit inputs;
|
|
||||||
hostname = "rotterdam";
|
|
||||||
};
|
|
||||||
modules = [
|
|
||||||
{ nixpkgs.overlays = [ inputs.self.overlays.default ]; }
|
|
||||||
{
|
|
||||||
home = {
|
|
||||||
username = "user";
|
|
||||||
homeDirectory = "/home/user";
|
|
||||||
stateVersion = "22.05";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
((inputs.import-tree.initFilter (p: lib.hasSuffix ".nix" p)) ./_user)
|
|
||||||
]
|
|
||||||
++ (with inputs.self.modules.homeManager; [
|
|
||||||
# system aspects
|
|
||||||
base
|
|
||||||
cli
|
|
||||||
desktop
|
|
||||||
gaming
|
|
||||||
|
|
||||||
# other aspects
|
|
||||||
stylix
|
|
||||||
niri
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue