Move functions to helper.nix
This commit is contained in:
parent
1bf5c9fb1d
commit
547c435ce8
2 changed files with 96 additions and 102 deletions
57
helpers.nix
Normal file
57
helpers.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
inputs:
|
||||
with inputs;
|
||||
with inputs.nixpkgs.lib; {
|
||||
mergeHosts = lists.foldl' (
|
||||
a: b: attrsets.recursiveUpdate a b
|
||||
) {};
|
||||
|
||||
mkHost = hostname: {
|
||||
platform ? "x86_64-linux",
|
||||
suite,
|
||||
user ? "fern",
|
||||
extraModules ? [],
|
||||
}: {
|
||||
nixosConfigurations.${hostname} = nixosSystem rec {
|
||||
system = platform;
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
permittedInsecurePackages = [
|
||||
"dotnet-sdk-6.0.428"
|
||||
"dotnet-runtime-6.0.36"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
specialArgs = {
|
||||
inherit
|
||||
hostname
|
||||
nixpkgs
|
||||
suite
|
||||
platform
|
||||
user
|
||||
; # Inherit variables.
|
||||
|
||||
userPackages = {
|
||||
fluffychat = fluffychat-2_0_0.legacyPackages.${system}.fluffychat;
|
||||
feishin = feishin-0_17_0.legacyPackages.${system}.feishin;
|
||||
webone = pkgs.callPackage ./packages/webone {};
|
||||
};
|
||||
|
||||
secrets = builtins.toString inputs.secrets; # Secrets directory.
|
||||
};
|
||||
|
||||
modules =
|
||||
[
|
||||
nixvim.nixosModules.nixvim
|
||||
./suites/common.nix
|
||||
./suites/${suite}.nix
|
||||
./hosts/${suite}/${hostname}.nix
|
||||
]
|
||||
++ (filesystem.listFilesRecursive ./modules)
|
||||
++ extraModules;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue