commit d21ac43b0e92ebe93d5dafd00e9368c81be6ad4f
parent d0d91f76602d56feb31c26a34786662165b5f163
Author: benjamin paul <bpaul@bpaul.xyz>
Date: Thu, 1 Jul 2021 18:29:21 +1000
nixpkgs-fmt
Diffstat:
7 files changed, 76 insertions(+), 62 deletions(-)
diff --git a/flake.nix b/flake.nix
@@ -27,8 +27,15 @@
};
};
- outputs = { self, nixpkgs, home-manager, neovim,
- vim-plugins-overlay, idris2-pkgs, ... }@inputs:
+ outputs =
+ { self
+ , nixpkgs
+ , home-manager
+ , neovim
+ , vim-plugins-overlay
+ , idris2-pkgs
+ , ...
+ }@inputs:
let
overlays = [
neovim.overlay
@@ -68,16 +75,18 @@
customize =
with import nixpkgs { system = "x86_64-linux"; };
pkgs.callPackage ./customize.nix { };
- };
+ };
defaultApp.x86_64-linux = {
type = "app";
program = "${self.packages.x86_64-linux.customize}/bin/customize";
};
- apps.x86_64-linux = lib.mapAttrs (n: v: {
- type = "app";
- program = "${self.home.${n}.activationPackage}/activate";
- }) self.home;
+ apps.x86_64-linux = lib.mapAttrs
+ (n: v: {
+ type = "app";
+ program = "${self.home.${n}.activationPackage}/activate";
+ })
+ self.home;
#home = homeConfig ./home/home.nix;
home = libExtra.mapOnDir' ./home/profiles (name: a: lib.nameValuePair (lib.removeSuffix ".nix" name) (homeConfig "${toString ./home/profiles}/${name}"));
};
diff --git a/home/home.nix b/home/home.nix
@@ -6,7 +6,8 @@ let
scripts = libExtra.mapOnDir ./scripts (name: a:
libExtra.createScriptFile name "${toString ./scripts}/${name}"
);
-in {
+in
+{
home.stateVersion = "20.09";
imports = [
diff --git a/home/modules/default.nix b/home/modules/default.nix
@@ -6,22 +6,25 @@ let
libExtra = import ../../lib { inherit lib; };
importModulesRecursively = dir:
- let d = builtins.readDir dir; in
- if hasAttrByPath ["default.nix"] d then [""] else
- concatLists (mapAttrsToList (n: v:
- if v == "directory" then
- map (f: "${n}/${f}") (importModulesRecursively "${toString dir}/${n}")
- else ["${n}"])
- d);
+ let d = builtins.readDir dir; in
+ if hasAttrByPath [ "default.nix" ] d then [ "" ] else
+ concatLists (mapAttrsToList
+ (n: v:
+ if v == "directory" then
+ map (f: "${n}/${f}") (importModulesRecursively "${toString dir}/${n}")
+ else [ "${n}" ])
+ d);
callImportModules = dir:
- let d = builtins.readDir dir; in
- concatLists (mapAttrsToList (n: v:
- if v == "directory" then
- map (f: "${toString dir}/${n}/${f}") (importModulesRecursively "${toString dir}/${n}")
- else "${toString dir}/${n}")
- (filterAttrs (n: v: n != "default.nix") d));
-in {
+ let d = builtins.readDir dir; in
+ concatLists (mapAttrsToList
+ (n: v:
+ if v == "directory" then
+ map (f: "${toString dir}/${n}/${f}") (importModulesRecursively "${toString dir}/${n}")
+ else "${toString dir}/${n}")
+ (filterAttrs (n: v: n != "default.nix") d));
+in
+{
# Basically just imports everything
# If importing a directory which contains a default.nix treat it like
# it is its own module
diff --git a/home/modules/dev/idris2/lsp.nix b/home/modules/dev/idris2/lsp.nix
@@ -1,3 +1 @@
-stdenv.mkDerivation {
-
-}
+stdenv.mkDerivation { }
diff --git a/home/profiles/arch.nix b/home/profiles/arch.nix
@@ -6,7 +6,8 @@ let
scripts = libExtra.mapOnDirRec ../scripts (name: a:
libExtra.createScriptFile name "${toString ../scripts}/${name}"
);
-in {
+in
+{
home.stateVersion = "20.09";
imports = [
diff --git a/lib/default.nix b/lib/default.nix
@@ -13,4 +13,4 @@ let
import path { inherit lib; }
));
in
-foldAttrs (n: a: n) [] (attrValues files)
+foldAttrs (n: a: n) [ ] (attrValues files)
diff --git a/lib/dirs.nix b/lib/dirs.nix
@@ -5,57 +5,59 @@ with lib;
rec {
/*
- * Recursively read a directory
- * Ugly code warning!
- */
+ * Recursively read a directory
+ * Ugly code warning!
+ */
readDirRec = dir:
- let d = builtins.readDir dir; in
- foldAttrs (n: a: n) [] (attrValues (mapAttrs (n: v:
- if v == "directory" then
- # Add the directory name to the start of the file
- # e.g. file.nix in directory called dir -> dir/file.nix
- mapAttrs' (fName: fVal:
- nameValuePair "${n}/${fName}" "${n}/${fName}")
- (readDirRec "${toString dir}/${n}")
-
- # Else it is a normal file
- # Yeah dont mind this weird stuff it's so that the
- # directory stuff works lol
- else {${n} = n;})
- d));
+ let d = builtins.readDir dir; in
+ foldAttrs (n: a: n) [ ] (attrValues (mapAttrs
+ (n: v:
+ if v == "directory" then
+ # Add the directory name to the start of the file
+ # e.g. file.nix in directory called dir -> dir/file.nix
+ mapAttrs'
+ (fName: fVal:
+ nameValuePair "${n}/${fName}" "${n}/${fName}")
+ (readDirRec "${toString dir}/${n}")
+
+ # Else it is a normal file
+ # Yeah dont mind this weird stuff it's so that the
+ # directory stuff works lol
+ else { ${n} = n; })
+ d));
/*
- * Map the function fn to every file in dir
- */
+ * Map the function fn to every file in dir
+ */
mapOnDir = dir: fn:
- let d = builtins.readDir dir; in
- mapAttrs (fn) d;
+ let d = builtins.readDir dir; in
+ mapAttrs (fn) d;
mapOnDir' = dir: fn:
- let d = builtins.readDir dir; in
- mapAttrs' (fn) d;
+ let d = builtins.readDir dir; in
+ mapAttrs' (fn) d;
mapOnDirRec = dir: fn:
- let d = readDirRec dir; in
- mapAttrs (fn) d;
+ let d = readDirRec dir; in
+ mapAttrs (fn) d;
mapOnDirRec' = dir: fn:
- let d = readDirRec dir; in
- mapAttrs' (fn) d;
+ let d = readDirRec dir; in
+ mapAttrs' (fn) d;
importDir = dir:
- map (file: "${toString dir}/${file}") (filter (f: f != "default.nix") (attrValues (mapOnDir dir (name: a:
- name))));
+ map (file: "${toString dir}/${file}") (filter (f: f != "default.nix") (attrValues (mapOnDir dir (name: a:
+ name))));
importDir' = dir:
- map (file: "${toString dir}/${file}") (filter (f: f != "default.nix") (attrValues (mapOnDir' dir (name: a:
- name))));
+ map (file: "${toString dir}/${file}") (filter (f: f != "default.nix") (attrValues (mapOnDir' dir (name: a:
+ name))));
importDirRec = dir:
- map (file: "${toString dir}/${file}") (filter (f: f != "default.nix" && hasSuffix ".nix" f) (attrValues (mapOnDirRec dir (name: a:
- name))));
+ map (file: "${toString dir}/${file}") (filter (f: f != "default.nix" && hasSuffix ".nix" f) (attrValues (mapOnDirRec dir (name: a:
+ name))));
importDirRec' = dir:
- map (file: "${toString dir}/${file}") (filter (f: f != "default.nix" && hasSuffix ".nix" f) (attrValues (mapOnDirRec' dir (name: a:
- name))));
+ map (file: "${toString dir}/${file}") (filter (f: f != "default.nix" && hasSuffix ".nix" f) (attrValues (mapOnDirRec' dir (name: a:
+ name))));
}