systems -> hosts

moved functions to /lib

inputs over imports

turned each module file into a nixosModule

moved registry and $NIX_PATH pinning to /modules/pinning.nix
This commit is contained in:
Gerg-L 2023-06-22 22:55:43 -04:00
parent ee2beea680
commit f43d0b741c
42 changed files with 224 additions and 240 deletions

View file

@ -3,9 +3,9 @@
#channels
master.url = "github:nixos/nixpkgs";
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
stable.url = "github:nixos/nixpkgs/nixos-22.11";
stable.url = "github:nixos/nixpkgs/nixos-23.05";
pipewire_fix.url = "github:nixos/nixpkgs/45a55711fe12d0aada3aa04746082cf1b83dfbf3";
#nix 2.16
#nix 2.17
nix.url = "github:nixos/nix/03f9ff6ea59d21c6d7b29c64a03d5041bd621261";
nixos-generators = {
@ -20,9 +20,9 @@
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "unstable";
};
#the-argus is awesome
spicetify-nix = {
url = "github:the-argus/spicetify-nix";
#url = "github:the-argus/spicetify-nix";
url = "path:/home/gerg/Projects/spicetify-nix";
inputs.nixpkgs.follows = "unstable";
};
#my own packages
@ -40,51 +40,30 @@
};
};
outputs = inputs @ {
self,
unstable,
nixos-generators,
...
}: let
inherit (unstable) lib;
importAll = path:
builtins.filter (lib.hasSuffix ".nix")
(lib.filesystem.listFilesRecursive path);
mkSystems = system: names:
lib.genAttrs names (
name:
lib.nixosSystem {
inherit system;
specialArgs = {inherit inputs self;};
modules =
importAll ./modules
++ importAll (self + "/systems/" + name);
}
);
mkDisko = names:
lib.genAttrs names (
name: (import (self + "/systems/" + name + "/disko.nix") {inherit inputs;})
);
withSystem = f:
lib.fold lib.recursiveUpdate {}
(map (s: f s) ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]);
lib = import ./lib inputs;
in
withSystem (
lib.withSystem (
system: let
pkgs = unstable.legacyPackages.${system};
in {
inherit lib;
nixosConfigurations =
mkSystems
lib.mkSystems
"x86_64-linux"
[
"gerg-desktop"
"game-laptop"
"moms-laptop"
];
nixosModules = lib.mkModules ./modules;
diskoConfigurations =
mkDisko
lib.mkDisko
[
"gerg-desktop"
"game-laptop"
@ -108,16 +87,7 @@
];
};
}
// builtins.listToAttrs (
map (module: {
name = lib.removeSuffix ".nix" (builtins.baseNameOf module);
value = pkgs.callPackage module {};
})
(
builtins.filter (lib.hasSuffix ".nix")
(lib.filesystem.listFilesRecursive ./pkgs)
)
);
// lib.mkPkgs pkgs ./pkgs;
}
);
}