switched modules to flakes

This commit is contained in:
Dennis Wuitz
2023-12-24 18:48:52 +01:00
parent aca834a717
commit 469038e980
37 changed files with 150 additions and 2197 deletions

View File

@ -4,9 +4,17 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-modules = {
url = "github:SuperSandro2000/nixos-modules";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs = {
nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs";
};
};
nix-index-database = {
@ -15,33 +23,36 @@
};
};
outputs = { nixpkgs, nix-index-database, sops-nix, ... }: {
src = builtins.filterSource (path: type: type == "directory" || lib.hasSuffix ".nix" (baseNameOf path)) ./.;
ls = dir: lib.attrNames (builtins.readDir (src + "/${dir}"));
fileList = dir: map (file: ./. + "/${dir}/${file}") (ls dir);
outputs = { nixpkgs, nixos-modules, nix-index-database, sops-nix, ... }:
let
inherit (nixpkgs) lib;
in {
nixosConfigurations = let
constructSystem = {
hostname,
system ? "x86_64-linux",
modules ? [],
users ? [],
}: nixpkgs.lib.nixosSystem {
inherit system hostname;
}: lib.nixosSystem {
inherit system;
modules = [
nixos-modules.nixosModule
sops-nix.nixosModules.sops
nix-index-database.nixosModules.nix-index
./system/programs.nix
./system/configuration.nix
./system/${hostname}/configuration.nix
] ++ fileList "modules" ++ modules ++ map (user: ./users/${user}/default.nix ) users;
./systems/programs.nix
./systems/configuration.nix
./systems/${hostname}/configuration.nix
] ++ modules ++ map(user: ./users/${user}) users;
};
in {
photon = constructSystem {
hostname = "photon"
hostname = "photon";
};
palatine-hill = constructSystem {
hostname = "palatine-hill"
hostname = "palatine-hill";
};
};
};