Use flake-utils to map flake outputs.
This commit is contained in:
parent
5a98a03819
commit
44237e65ae
1 changed files with 61 additions and 60 deletions
35
flake.nix
35
flake.nix
|
@ -7,6 +7,7 @@
|
|||
nixpkgs.url = "github:/NixOS/nixpkgs/nixos-unstable";
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
||||
impermanence.url = "github:nix-community/impermanence";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
alejandra = {
|
||||
url = "github:kamadorueda/alejandra/3.0.0";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -20,28 +21,25 @@
|
|||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
alejandra,
|
||||
mailserver,
|
||||
sops-nix,
|
||||
...
|
||||
} @ attrs: let
|
||||
} @ attrs:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
inherit (nixpkgs) lib;
|
||||
fn = import ./fn.nix {inherit lib;};
|
||||
mappedFormatter = builtins.mapAttrs (arch: packages: packages.default) alejandra.packages;
|
||||
mappedApps =
|
||||
builtins.mapAttrs (_arch: packages: {
|
||||
"lint" = {
|
||||
type = "app";
|
||||
program = "${packages.statix}/bin/statix";
|
||||
};
|
||||
})
|
||||
nixpkgs.legacyPackages;
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
machineList = fn.lst {
|
||||
p = toString ./machines;
|
||||
t = "directory";
|
||||
b = false;
|
||||
};
|
||||
nixosSystemFor = machine: {
|
||||
name = machine;
|
||||
value = let
|
||||
configFiles = fn.lst {
|
||||
p = toString ./config;
|
||||
b = true;
|
||||
|
@ -54,9 +52,6 @@
|
|||
p = toString ./services;
|
||||
b = true;
|
||||
};
|
||||
nixosSystemFor = machine: {
|
||||
name = machine;
|
||||
value = let
|
||||
machinePath = lib.concatStringsSep "/" [(toString ./.) "machines" machine];
|
||||
machineFiles = lib.filter (lib.strings.hasSuffix ".nix") (fn.lst {
|
||||
p = machinePath;
|
||||
|
@ -83,8 +78,14 @@
|
|||
};
|
||||
};
|
||||
in {
|
||||
apps = mappedApps;
|
||||
formatter = mappedFormatter;
|
||||
nixosConfigurations = lib.listToAttrs (map nixosSystemFor machineList);
|
||||
apps = {
|
||||
"lint" = {
|
||||
type = "app";
|
||||
program = "${pkgs.statix}/bin/statix";
|
||||
};
|
||||
};
|
||||
formatter = alejandra.defaultPackage."${system}";
|
||||
packages.nixosConfigurations = lib.listToAttrs (map nixosSystemFor machineList);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue