1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-29 11:07:44 +00:00

Refactor everything to make usage easier with

mutiple systems, also merge all abstractions
to avoid huge desctructions in the attrset input.
This commit is contained in:
RGBCube 2023-12-10 18:31:37 +03:00
parent a0fa73b873
commit ee2055928c
No known key found for this signature in database
47 changed files with 343 additions and 279 deletions

29
lib/configuration.nix Normal file
View file

@ -0,0 +1,29 @@
rec {
systemConfiguration = configuration: configuration;
systemPackages = packages: systemConfiguration {
environment.systemPackages = packages;
};
systemFonts = packages: systemConfiguration {
fonts.packages = packages;
};
userHomeConfiguration = users: configuration: {
home-manager.users = builtins.foldl' (final: user: final // {
${user} = configuration;
}) {} (if builtins.isList users then users else [ users ]);
};
# FIXME: Don't hardcode these.
graphicalConfiguration = userHomeConfiguration "nixos";
graphicalPackages = packages: graphicalConfiguration {
home.packages = packages;
};
# FIXME: Don't hardcode these.
homeConfiguration = userHomeConfiguration [ "nixos" "root" ];
homePackages = packages: homeConfiguration {
home.packages = packages;
};
}

9
lib/default.nix Normal file
View file

@ -0,0 +1,9 @@
lib:
(import ./configuration.nix)
//
(import ./merge.nix lib)
//
(import ./modules.nix)
//
(import ./values.nix)

8
lib/merge.nix Normal file
View file

@ -0,0 +1,8 @@
lib:
rec {
merge = lib.recursiveUpdate;
merge3 = x: y: merge (merge x y);
merge4 = x: y: merge3 (merge x y);
merge5 = x: y: merge4 (merge x y);
}

8
lib/modules.nix Normal file
View file

@ -0,0 +1,8 @@
{
importModules = modules: {
imports = builtins.map (module: if builtins.isPath module then
module
else
../modules/${module}) modules;
};
}

14
lib/values.nix Normal file
View file

@ -0,0 +1,14 @@
{
enabled = attributes: attributes // {
enable = true;
};
normalUser = attributes: attributes // {
isNormalUser = true;
};
graphicalUser = attributes: attributes // {
extraGroups = [ "graphical" ] ++ (attributes.extraGroups or []);
isNormalUser = true;
};
}