Add initial flake file.
This commit is contained in:
parent
315f401d5f
commit
ef7eb5f9e4
2 changed files with 241 additions and 0 deletions
42
flake.nix
Normal file
42
flake.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
description = "NixOS Configuration";
|
||||
inputs = rec {
|
||||
nixpkgs.url = "github:/NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-unstable.url = "github:/NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-stable.url = "github:/NixOS/nixpkgs/nixos-22.11";
|
||||
mailserver.url = "gitlab:/simple-nixos-mailserver/nixos-mailserver";
|
||||
sops-nix = {
|
||||
url = github:Mic92/sops-nix;
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
outputs = { self, nixpkgs, mailserver, sops-nix, ... }@attrs: let
|
||||
lib = nixpkgs.lib;
|
||||
fn = import ./fn.nix { inherit lib; };
|
||||
system = "x86_64-linux";
|
||||
machineList = fn.lst { p = (toString ./machines); t = "directory"; b = false; };
|
||||
configFiles = fn.lst { p = (toString ./config); b = true; };
|
||||
pkgsFiles = fn.lst { p = (toString ./pkgs); b = true; };
|
||||
serviceFiles = fn.lst { p = (toString ./services); b = true; };
|
||||
nixosSystemFor = machine: {
|
||||
name = machine;
|
||||
value = let
|
||||
machinePath = lib.concatStringsSep "/" [(toString ./.) "machines" machine];
|
||||
machineFiles = fn.lst { p = machinePath; b = true; };
|
||||
in nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = attrs;
|
||||
modules = [
|
||||
(toString ./options/machine.nix)
|
||||
sops-nix.nixosModules.sops
|
||||
] ++ machineFiles
|
||||
++ configFiles
|
||||
++ pkgsFiles
|
||||
++ serviceFiles;
|
||||
};
|
||||
};
|
||||
result = lib.listToAttrs (map nixosSystemFor ["Lilim"]);
|
||||
in {
|
||||
nixosConfigurations = lib.listToAttrs (map nixosSystemFor machineList);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue