restructure
- users/rin/default.nix -> users/rin.nix - users/rin/home.nix +-> users/rin.nix - users/rin/*.nix -> modules/user/*.nix - users/rin/scripts/ -> scripts/ - hosts/winter/default.nix -> hosts/winter.nix - hosts/winter/*.nix -> modules/system/*.nix - modules are dynamically imported as sets for system and user
This commit is contained in:
parent
84f08a3a1c
commit
c86be50084
30 changed files with 178 additions and 157 deletions
32
flake.nix
32
flake.nix
|
|
@ -17,10 +17,32 @@
|
|||
|
||||
outputs = inputs: with inputs;
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
|
||||
getPaths = root: builtins.map
|
||||
(path: root + ("/" + path)) # Prepends root path
|
||||
(builtins.attrNames (builtins.readDir root)); # Reads root path
|
||||
|
||||
modules =
|
||||
let
|
||||
getName = path: lib.removeSuffix ".nix" ( # Strip extension
|
||||
lib.last ( # Gets the last part (filename)
|
||||
lib.splitString "/" ( # Splits the path into components
|
||||
builtins.toString path # Converts the path into a string
|
||||
)
|
||||
)
|
||||
);
|
||||
genModulePaths = basePath: builtins.listToAttrs (
|
||||
builtins.map (path: {
|
||||
name = getName path;
|
||||
value = path;
|
||||
}) (getPaths basePath)
|
||||
);
|
||||
in {
|
||||
user = genModulePaths ./modules/user;
|
||||
system = genModulePaths ./modules/system;
|
||||
};
|
||||
|
||||
customPackages = pkgs:
|
||||
let
|
||||
callPackage = pkgs.callPackage;
|
||||
|
|
@ -32,7 +54,7 @@
|
|||
overlays = (builtins.map
|
||||
(path: import path) # Imports path
|
||||
(builtins.filter
|
||||
(path: nixpkgs.lib.hasSuffix ".nix" path) # Checks file extension
|
||||
(path: lib.hasSuffix ".nix" path) # Checks file extension
|
||||
(getPaths ./overlays)
|
||||
)
|
||||
) ++ [(self: super: customPackages super)]
|
||||
|
|
@ -55,23 +77,23 @@
|
|||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = {
|
||||
inherit inputs;
|
||||
inherit inputs modules;
|
||||
enableGUI = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
nixosConfigurations."winter" = nixpkgs.lib.nixosSystem {
|
||||
nixosConfigurations."winter" = lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
base
|
||||
home-manager.nixosModules.home-manager
|
||||
./hosts/winter
|
||||
./hosts/winter.nix
|
||||
secrets.nixosModules.winter
|
||||
];
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
inherit inputs modules;
|
||||
enableGUI = true;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue