mirror of
https://github.com/RGBCube/ncc
synced 2025-07-29 19:17:45 +00:00
Clean: Clean flake.nix
This commit is contained in:
parent
6d5003935c
commit
0af238c15b
1 changed files with 17 additions and 12 deletions
29
flake.nix
29
flake.nix
|
@ -25,36 +25,40 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
lib = nixpkgs.lib;
|
importConfiguration = directory:
|
||||||
|
|
||||||
importConfiguration = directory: {
|
let
|
||||||
nixosConfigurations.${builtins.baseNameOf directory} =
|
hostPlatform = import (directory + "/platform.nix");
|
||||||
let
|
# The folder name is the host name of the machine.
|
||||||
hostPlatform = import (directory + "/platform.nix");
|
hostName = builtins.baseNameOf directory;
|
||||||
in
|
userName = import (directory + "/username.nix");
|
||||||
lib.nixosSystem {
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
nixosConfigurations.${hostName} = nixpkgs.lib.nixosSystem {
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit lib;
|
lib = nixpkgs.lib;
|
||||||
|
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
system = hostPlatform;
|
system = hostPlatform;
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Helper function for DRY.
|
||||||
homeManagerConfiguration = attrs: {
|
homeManagerConfiguration = attrs: {
|
||||||
home-manager.users.${import (directory + "/username.nix")} = attrs;
|
home-manager.users.${userName} = attrs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
directory
|
directory
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
|
||||||
|
# Extra configuration derived from the metadata.
|
||||||
{
|
{
|
||||||
networking.hostName = builtins.baseNameOf directory;
|
networking.hostName = builtins.baseNameOf directory;
|
||||||
nixpkgs.hostPlatform = hostPlatform;
|
nixpkgs.hostPlatform = hostPlatform;
|
||||||
}
|
|
||||||
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{
|
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
}
|
}
|
||||||
|
@ -62,6 +66,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
# Basically imports all machines in ./machines/.
|
||||||
builtins.foldl' lib.recursiveUpdate {} (builtins.map importConfiguration [
|
builtins.foldl' lib.recursiveUpdate {} (builtins.map importConfiguration [
|
||||||
./machines/asus # HACK: Use a function to list the directory.
|
./machines/asus # HACK: Use a function to list the directory.
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue