forked from pub-solar/os
Merge pull request #15 from jtojnar/check-fixes
flake: Fix `nix flake check`
This commit is contained in:
commit
df88ef7bb0
35
flake.nix
35
flake.nix
|
@ -6,13 +6,25 @@
|
|||
|
||||
outputs = inputs@{ self, home, nixpkgs }:
|
||||
let
|
||||
inherit (builtins) listToAttrs baseNameOf attrNames readDir;
|
||||
inherit (builtins) listToAttrs baseNameOf attrNames attrValues readDir;
|
||||
inherit (nixpkgs.lib) removeSuffix;
|
||||
system = "x86_64-linux";
|
||||
|
||||
# Generate an attribute set by mapping a function over a list of values.
|
||||
genAttrs' = values: f: listToAttrs (map f values);
|
||||
|
||||
# Convert a list to file paths to attribute set
|
||||
# that has the filenames stripped of nix extension as keys
|
||||
# and imported content of the file as value.
|
||||
pathsToImportedAttrs = paths:
|
||||
genAttrs' paths (path: {
|
||||
name = removeSuffix ".nix" (baseNameOf path);
|
||||
value = import path;
|
||||
});
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = self.overlays;
|
||||
overlays = attrValues self.overlays;
|
||||
config = { allowUnfree = true; };
|
||||
};
|
||||
|
||||
|
@ -23,28 +35,25 @@
|
|||
|
||||
overlay = import ./pkgs;
|
||||
|
||||
overlays = let
|
||||
overlays = map (name: import (./overlays + "/${name}"))
|
||||
(attrNames (readDir ./overlays));
|
||||
in overlays;
|
||||
overlays =
|
||||
let
|
||||
overlayDir = ./overlays;
|
||||
fullPath = name: overlayDir + "/${name}";
|
||||
overlayPaths = map fullPath (attrNames (readDir overlayDir));
|
||||
in pathsToImportedAttrs overlayPaths;
|
||||
|
||||
packages.x86_64-linux = {
|
||||
inherit (pkgs) sddm-chili dejavu_nerdfont purs pure;
|
||||
};
|
||||
|
||||
nixosModules = let
|
||||
prep = map (path: {
|
||||
name = removeSuffix ".nix" (baseNameOf path);
|
||||
value = import path;
|
||||
});
|
||||
|
||||
# modules
|
||||
moduleList = import ./modules/list.nix;
|
||||
modulesAttrs = listToAttrs (prep moduleList);
|
||||
modulesAttrs = pathsToImportedAttrs moduleList;
|
||||
|
||||
# profiles
|
||||
profilesList = import ./profiles/list.nix;
|
||||
profilesAttrs = { profiles = listToAttrs (prep profilesList); };
|
||||
profilesAttrs = { profiles = pathsToImportedAttrs profilesList; };
|
||||
|
||||
in modulesAttrs // profilesAttrs;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue