From e0a862ce4df9845ddc0ba26c3084eadb3b698d9d Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Sat, 10 Aug 2024 15:50:20 -0500 Subject: [PATCH] more pipes --- lib/extended.nix | 10 ++++++++-- lib/generators.nix | 22 ++++------------------ modules/iso.nix | 5 +++++ modules/nix.nix | 6 +++++- 4 files changed, 22 insertions(+), 21 deletions(-) create mode 100644 modules/iso.nix diff --git a/lib/extended.nix b/lib/extended.nix index c1659a9..1338514 100644 --- a/lib/extended.nix +++ b/lib/extended.nix @@ -1,6 +1,6 @@ inputs: final: prev: let - inherit (builtins) listToAttrs substring filter; + inherit (builtins) listToAttrs substring; inherit (final) concatStringsSep hasSuffix @@ -12,6 +12,7 @@ let inherit (final.filesystem) listFilesRecursive; in let + enabled = { enable = true; }; @@ -68,7 +69,7 @@ let isNixFile = p: hasSuffix ".nix" p; isDefaultNixFile = p: hasSuffix "default.nix" p; - filterNotDefaultNixFile = paths: filter (p: !(isDefaultNixFile p) && (isNixFile p)) paths; + filterNotDefaultNixFile = paths: builtins.filter (p: !(isDefaultNixFile p) && (isNixFile p)) paths; listNixFilesRecursive = dir: filterNotDefaultNixFile (listFilesRecursive dir); # defaultLinuxPackage = flake: flake.packages.x86_64-linux.default; @@ -81,6 +82,10 @@ let pkgs = pkgsFromSystem system; pkg = pkgFromSystem system; }; + + functional = { + filterF = list: f: builtins.filter f list; + }; in { inherit @@ -99,5 +104,6 @@ in pkgFromSystem overlayFrom flakeFromSystem + functional ; } diff --git a/lib/generators.nix b/lib/generators.nix index 12ef329..f22cef0 100644 --- a/lib/generators.nix +++ b/lib/generators.nix @@ -20,31 +20,17 @@ let flake = flakeFromSystem "x86_64-linux"; hostPath = host: ../. + "/hosts/${host}"; # all nix files not including pkgs.nix - hostFiles = host: filter isNixFile (listFilesRecursive (hostPath host)); + # hostFiles = host: filter isNixFile (listFilesRecursive (hostPath host)); + + hostFiles = host: host |> hostPath |> listFilesRecursive |> filter isNixFile; - # hostFiles = - # host: - # filter isNixFile ( - # host - # |> hostPath - # |> listFilesRecursive - # ) - mkIso = nixosSystem { system = "x86_64-linux"; modules = [ inputs.lix-module.nixosModules.default self.nixosModules.nix self.nixosModules.essentials - ( - { pkgs, modulesPath, ... }: - { - imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ]; - environment.systemPackages = (with pkgs; [ neovim ]) ++ [ - self.packages.${pkgs.system}.default - ]; - } - ) + self.nixosModules.iso ]; specialArgs = { inherit diff --git a/modules/iso.nix b/modules/iso.nix new file mode 100644 index 0000000..be97c89 --- /dev/null +++ b/modules/iso.nix @@ -0,0 +1,5 @@ +{ pkgs, modulesPath, ... }: +{ + imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ]; + environment.systemPackages = (with pkgs; [ neovim ]); +} diff --git a/modules/nix.nix b/modules/nix.nix index a4a453c..7c49bd5 100644 --- a/modules/nix.nix +++ b/modules/nix.nix @@ -16,7 +16,11 @@ in # nix.package = pkgs.nixVersions.latest; nix = { settings = { - experimental-features = [ "nix-command" "flakes" "pipe-operator"]; + experimental-features = [ + "nix-command" + "flakes" + "pipe-operator" + ]; use-xdg-base-directories = true; };