Move to recursiveMod, nixdirfmt

This commit is contained in:
kat witch 2021-09-04 01:14:17 +01:00
parent 3a4458eae5
commit 76a479f14e
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
66 changed files with 313 additions and 335 deletions

View file

@ -10,7 +10,7 @@ with lib; {
nix.config = { nix.config = {
extra-platforms = ["aarch64-linux" "armv6l-linux" "armv7l-linux"]; extra-platforms = [ "aarch64-linux" "armv6l-linux" "armv7l-linux" ];
#extra-sandbox-paths = with channels.cipkgs; map (package: builtins.unsafeDiscardStringContext "${package}?") [bash qemu "/run/binfmt"]; #extra-sandbox-paths = with channels.cipkgs; map (package: builtins.unsafeDiscardStringContext "${package}?") [bash qemu "/run/binfmt"];
}; };

View file

@ -5,7 +5,7 @@
channels.nixfiles.path = ../.; channels.nixfiles.path = ../.;
nix.config = { nix.config = {
extra-platforms = ["aarch64-linux" "armv6l-linux" "armv7l-linux"]; extra-platforms = [ "aarch64-linux" "armv6l-linux" "armv7l-linux" ];
#extra-sandbox-paths = with channels.cipkgs; map (package: builtins.unsafeDiscardStringContext "${package}?") [bash qemu "/run/binfmt"]; #extra-sandbox-paths = with channels.cipkgs; map (package: builtins.unsafeDiscardStringContext "${package}?") [bash qemu "/run/binfmt"];
}; };

View file

@ -0,0 +1,5 @@
{ ... }: {
excludes = [
"to-do"
];
}

View file

@ -13,15 +13,20 @@
]; ];
boot = { boot = {
kernelModules = mkForce ["loop" "atkbd"]; kernelModules = mkForce [ "loop" "atkbd" ];
initrd = { initrd = {
includeDefaultModules = false; includeDefaultModules = false;
availableKernelModules = mkForce [ availableKernelModules = mkForce [
"mmc_block" "mmc_block"
"usbhid" "usbhid"
"ext4" "ext4"
"hid_generic" "hid_lenovo" "hid_apple" "hid_roccat" "hid_generic"
"hid_logitech_hidpp" "hid_logitech_dj" "hid_microsoft" "hid_lenovo"
"hid_apple"
"hid_roccat"
"hid_logitech_hidpp"
"hid_logitech_dj"
"hid_microsoft"
]; ];
}; };
}; };

View file

@ -1,4 +1,6 @@
{ sources, ... }: { { sources, ... }: {
functor = {
enable = true;
external = [ external = [
(import (sources.arcexprs + "/modules")).home-manager (import (sources.arcexprs + "/modules")).home-manager
(import (sources.katexprs + "/modules")).home (import (sources.katexprs + "/modules")).home
@ -6,4 +8,5 @@
(import sources.anicca).modules.home (import sources.anicca).modules.home
(sources.tf-nix + "/modules/home/secrets.nix") (sources.tf-nix + "/modules/home/secrets.nix")
]; ];
};
} }

View file

@ -74,7 +74,7 @@ in
settings = mkOption { settings = mkOption {
type = vimSettingsType; type = vimSettingsType;
default = {}; default = { };
example = literalExample '' example = literalExample ''
{ {
expandtab = true; expandtab = true;
@ -149,7 +149,8 @@ in
]; ];
}; };
in mkIf cfg.enable { in
mkIf cfg.enable {
programs.vim.package = vim; programs.vim.package = vim;
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
} }

View file

@ -70,7 +70,7 @@ in
config.tf = mkMerge (singleton config.tf = mkMerge (singleton
{ {
imports = [ imports = [
../../targets/common ../../targets/common.nix
]; ];
deps = { deps = {
select.allProviders = true; select.allProviders = true;

View file

@ -31,7 +31,7 @@ with lib;
options = { options = {
nixpkgs.crossOverlays = mkOption { nixpkgs.crossOverlays = mkOption {
type = types.listOf types.unspecified; type = types.listOf types.unspecified;
default = []; default = [ ];
}; };
}; };
config = { config = {
@ -72,7 +72,7 @@ with lib;
nixos = { nixos = {
extraModules = [ extraModules = [
"${toString sources.home-manager}/nixos" "${toString sources.home-manager}/nixos"
] ++ singleton meta.modules.nixos; ] ++ lib.singleton meta.modules.nixos;
specialArgs = { specialArgs = {
inherit (config.network) nodes; inherit (config.network) nodes;
inherit sources meta; inherit sources meta;

View file

@ -0,0 +1,5 @@
{ sources, ... }: {
functor = {
enable = true;
};
}

View file

@ -1,4 +1,6 @@
{ sources, ... }: { { sources, ... }: {
functor = {
enable = true;
external = [ external = [
(import (sources.arcexprs + "/modules")).nixos (import (sources.arcexprs + "/modules")).nixos
(import (sources.katexprs + "/modules")).nixos (import (sources.katexprs + "/modules")).nixos
@ -7,4 +9,5 @@
(sources.tf-nix + "/modules/nixos/secrets.nix") (sources.tf-nix + "/modules/nixos/secrets.nix")
(sources.tf-nix + "/modules/nixos/secrets-users.nix") (sources.tf-nix + "/modules/nixos/secrets-users.nix")
]; ];
};
} }

View file

@ -2,6 +2,7 @@
{ {
base16 = { base16 = {
inherit (config.home-manager.users.kat.base16) schemes alias;
console = { console = {
enable = true; enable = true;
scheme = config.home-manager.users.kat.base16.alias.default; scheme = config.home-manager.users.kat.base16.alias.default;

View file

@ -1,22 +0,0 @@
{ config, meta, lib, pkgs, ... }:
{
imports = with meta; [
users.kat.base
users.arc
users.hexchen
./system.nix
./kitty.nix
./home.nix
./profiles.nix
./shell.nix
./base16.nix
./network.nix
./access.nix
./locale.nix
./nix.nix
./ssh.nix
./packages.nix
./secrets.nix
];
}

View file

@ -0,0 +1,7 @@
{ config, meta, ... }: {
imports = with meta; [
users.kat.base
users.hexchen
users.arc
];
}

View file

@ -1,6 +1,8 @@
{ config, lib, pkgs, ... }: { config, meta, lib, pkgs, ... }:
{ {
imports = lib.optional (meta ? trusted) meta.trusted.secrets;
secrets = { secrets = {
root = "/var/lib/kat/secrets"; root = "/var/lib/kat/secrets";
persistentRoot = "/var/lib/kat/secrets"; persistentRoot = "/var/lib/kat/secrets";

View file

@ -1,17 +1,13 @@
rec { { lib, tree, ... }: with lib; let
common = ./armvcommon.nix; profiles = tree.dirs // tree.files;
armv7-base = ./armv7.nix; appendedProfiles = with profiles; {
armv6-base = ./armv6.nix;
aarch64-base = ./aarch64.nix;
aarch64 = { aarch64 = {
deploy.profile.cross = { deploy.profile.cross = {
enable = true; enable = true;
aarch64 = true; aarch64 = true;
}; };
imports = [ imports = [
aarch64-base aarch64
]; ];
}; };
armv7l = { armv7l = {
@ -20,8 +16,8 @@ rec {
armv7l = true; armv7l = true;
}; };
imports = [ imports = [
common arm-common
armv7-base armv7
]; ];
}; };
armv6l = { armv6l = {
@ -30,8 +26,10 @@ rec {
armv6l = true; armv6l = true;
}; };
imports = [ imports = [
common arm-common
armv6-base armv6
]; ];
}; };
} };
in
profiles // appendedProfiles

View file

@ -0,0 +1,4 @@
{ ... }: {
defaultOnly = true;
includeFolders.default.enable = true;
}

View file

@ -0,0 +1,9 @@
{ lib, tree, ... }@args: with lib;
let
wrappedBase = base: mapAttrs
(name: paths: {
imports = if isAttrs paths then attrValues paths else singleton paths;
})
(base);
in
(wrappedBase (filterAttrs (n: v: ! v ? "default") tree.dirs)) // (mapAttrs (n: v: removeAttrs v [ "default" ]) (filterAttrs (n: v: v ? "default") tree.dirs)) // (removeAttrs tree.files [ "default" ])

View file

@ -1,21 +0,0 @@
{ config, pkgs, meta, ... }:
{
imports = [
meta.services.dnscrypt-proxy
./adb.nix
./fonts.nix
./sway.nix
./filesystems.nix
./qt.nix
./gpg.nix
./xdg-portals.nix
./nfs.nix
./mingetty.nix
./sound.nix
];
services.tumbler.enable = true;
deploy.profile.gui = true;
}

View file

@ -1,28 +1,25 @@
let hardwareProfiles = { lib }: { lib, tree, ... }: with lib; let
let profiles = with profiles; lib.domainMerge profiles = (filterAttrs (n: v: v ? "default") tree.dirs)
{ // tree.defaultDirs
folder = ""; # not used in this usage // (mapAttrs (n: v: removeAttrs v [ "default" ]) (filterAttrs (n: v: v ? "default") tree.dirs))
folderPaths = [ // tree.files;
./. appendedProfiles = with profiles; {
../../trusted/profiles/hardware
];
} // {
ms-7b86 = { ms-7b86 = {
imports = [ imports = [
ms-7b86-base ms-7b86
ryzen ryzen
amdgpu amdgpu
]; ];
}; };
rm-310 = { rm-310 = {
imports = [ imports = [
rm-310-base rm-310
intel intel
]; ];
}; };
v330-14arr = { v330-14arr = {
imports = [ imports = [
v330-14arr-base v330-14arr
ryzen ryzen
amdgpu amdgpu
laptop laptop
@ -31,10 +28,11 @@ let hardwareProfiles = { lib }:
}; };
eeepc-1015pem = { eeepc-1015pem = {
imports = [ imports = [
eeepc-1015pem-base eeepc-1015pem
intel intel
laptop laptop
]; ];
}; };
}; in profiles; };
in { __functor = self: hardwareProfiles; isModule = false; } in
profiles // appendedProfiles

View file

@ -1,9 +1,11 @@
{ config, ... }: { ... }: {
imports = [
{ ({ config, ... }: {
deploy.profile.hardware.laptop = true; deploy.profile.hardware.laptop = true;
imports = [ imports = [
./light.nix ./light.nix
]; ];
})
];
} }

View file

@ -0,0 +1,7 @@
{ ... }: {
defaultOnly = true;
includeFolders = {
enable = true;
default.enable = true;
};
}

View file

@ -1,26 +1,26 @@
rec { { lib, sources, tree, ... }: with lib; let
common = ./common.nix; profiles = tree.dirs // tree.files;
ubuntu-base = ./ubuntu.nix; appendedProfiles = with profiles; {
oracle-base = ./oracle.nix; ubuntu = { config, ... }: {
ubuntu = {
deploy.profile.hardware.oracle = { deploy.profile.hardware.oracle = {
common = true;
ubuntu = true; ubuntu = true;
};
imports = [
common
ubuntu-base
];
};
oracle = {
deploy.profile.hardware.oracle = {
common = true; common = true;
oracle = true;
}; };
imports = [ imports = with import (sources.tf-nix + "/modules"); [
nixos.ubuntu-linux
common common
oracle-base
]; ];
}; };
} oracle = { config, ... }: {
deploy.profile.hardware.oracle = {
oracle = true;
common = true;
};
imports = with import (sources.tf-nix + "/modules"); [
nixos.oracle-linux
common
];
};
};
in
profiles // appendedProfiles

View file

@ -1,5 +0,0 @@
{ config, sources, ... }: {
imports = with import (sources.tf-nix + "/modules"); [
nixos.oracle-linux
];
}

View file

@ -0,0 +1,4 @@
{ ... }: {
defaultOnly = true;
includeFolders.default.enable = true;
}

View file

@ -1,5 +0,0 @@
{ sources, ... }: {
imports = with import (sources.tf-nix + "/modules"); [
nixos.ubuntu-linux
];
}

View file

@ -0,0 +1,5 @@
{ ... }: {
defaultOnly = true;
includeFolders.enable = true;
includeFolders.default.enable = true;
}

View file

@ -0,0 +1,18 @@
{ config, tf, lib, ... }: with lib;
{
kw.secrets.variables = mapListToAttrs
(field:
nameValuePair "wireless-${field}" {
path = "secrets/wifi";
inherit field;
}) [ "ssid" "password" ];
deploy.profile.hardware.wifi = true;
networking.wireless = {
enable = true;
networks.${builtins.unsafeDiscardStringsContext tf.variables.wireless-ssid.get} = {
pskRaw = tf.variables.wireless-password.get;
};
};
}

View file

@ -1,6 +0,0 @@
{ config, ... }:
{
deploy.profile.hardware.wifi = true;
networking.wireless.enable = true;
}

View file

@ -0,0 +1,5 @@
{ ... }: {
defaultOnly = true;
recursiveInclude = true;
includeFolders.default.enable = true;
}

View file

@ -0,0 +1,6 @@
{ ... }: {
includeFolders = {
enable = true;
default.enable = true;
};
}

View file

@ -1,6 +1,8 @@
{ config, pkgs, ... }: { ... }: {
imports = [
({ config, pkgs, ... }:
{ {
users.users.arc = { users.users.arc = {
uid = 1001; uid = 1001;
isNormalUser = true; isNormalUser = true;
@ -9,4 +11,6 @@
]; ];
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
})
];
} }

View file

@ -0,0 +1,7 @@
{ ... }: {
defaultOnly = true;
includeFolders = {
enable = true;
default.enable = true;
};
}

View file

@ -1,6 +1,8 @@
{ config, lib, pkgs, ... }: { ... }: {
imports = [
({ config, lib, pkgs, ... }:
{ {
users.users.hexchen = { users.users.hexchen = {
uid = 1002; uid = 1002;
isNormalUser = true; isNormalUser = true;
@ -35,4 +37,6 @@
programs.bat.enable = true; programs.bat.enable = true;
programs.jq.enable = true; programs.jq.enable = true;
}; };
})
];
} }

View file

@ -0,0 +1,7 @@
{ ... }: {
defaultOnly = true;
includeFolders = {
enable = true;
default.enable = true;
};
}

View file

@ -1,19 +0,0 @@
{ ... }:
{
imports = [
./vim
./shell.nix
./git.nix
./tmux.nix
./base16.nix
./xdg.nix
./ssh.nix
./packages.nix
./weechat.nix
./inputrc.nix
./secrets.nix
];
home.stateVersion = "20.09";
}

View file

@ -0,0 +1,3 @@
{ config, ... }: {
home.stateVersion = "20.09";
}

View file

@ -1,28 +1,30 @@
let katUser = { lib }: { lib, tree, ... }: with lib; let
let wrapImports = imports: mapAttrs
userImport = profile: { config, ... }: { (name: paths: { config, ... }: {
config.home-manager.users.kat = { config.home-manager.users.kat = {
imports = if isAttrs paths then attrValues paths else singleton paths;
};
})
imports;
dirImports = wrapImports tree.dirs;
serviceImports = wrapImports tree.dirs.services;
in
(removeAttrs dirImports (singleton "base")) // {
base = {
imports = [ imports = [
(./. + "/${profile}") dirImports.base
tree.files.nixos
]; ];
}; };
}; server = { };
serviceImport = profile: { config, ... }: { guiFull = {
config.home-manager.users.kat = { imports = with dirImports; [
imports = [ gui
(./services + "/${profile}") sway
dev
media
personal
]; ];
}; };
}; services = serviceImports;
profileNames = lib.folderList ./. [ "base" "services" ]; }
serviceNames = lib.folderList ./services [ ];
userProfiles = with userProfiles;
lib.genAttrs profileNames userImport // {
services = lib.genAttrs serviceNames serviceImport;
base = { imports = [ ./nixos.nix (userImport "base") ]; };
server = {};
guiFull = { imports = [ gui sway dev media personal ]; };
};
in
userProfiles;
in { __functor = self: katUser; isModule = false; }

View file

@ -1,12 +0,0 @@
{ config, lib, pkgs, ... }:
{
imports = [
./vim
./rink.nix
./shell.nix
./rustfmt.nix
./packages.nix
./cookiecutter.nix
];
}

View file

@ -0,0 +1,5 @@
{ ... }: {
excludes = [
"emacs"
];
}

View file

@ -1,16 +0,0 @@
{ config, ... }:
{
imports = [
./firefox
./packages.nix
./gtk.nix
./base16.nix
./foot.nix
./kitty.nix
./xdg.nix
./ranger.nix
./fonts.nix
./qt.nix
];
}

View file

@ -1,10 +0,0 @@
{ ... }:
{
imports = [
./mpv.nix
./obs.nix
./syncplay.nix
./packages.nix
];
}

View file

@ -1,15 +0,0 @@
{ ... }:
{
imports = [
./gpg.nix
./git.nix
./packages.nix
./weechat.nix
./email.nix
./shell.nix
./pass.nix
./taskwarrior.nix
./bitw.nix
];
}

View file

@ -7,6 +7,6 @@
''; '';
}; };
programs.zsh = { programs.zsh = {
shellAliases = mapListToAttrs (attr: nameValuePair "abby${attr}" "mpv $(bitw get secrets/abby -f ${attr})") ["radio" "tv"]; shellAliases = mapListToAttrs (attr: nameValuePair "abby${attr}" "mpv $(bitw get secrets/abby -f ${attr})") [ "radio" "tv" ];
}; };
} }

View file

@ -3,7 +3,7 @@
{ {
programs.neovim = { programs.neovim = {
extraConfig = '' extraConfig = ''
${source ./init.vim} source ${./init.vim}
''; '';
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; [
notmuch-vim notmuch-vim

View file

@ -0,0 +1,7 @@
{ ... }: {
defaultOnly = true;
recursiveInclude = true;
includeFolders = {
default.enable = true;
};
}

View file

@ -1,14 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./xkb.nix
./waybar
./wofi
./mako.nix
./sway.nix
./gammastep.nix
./konawall.nix
./packages.nix
];
}

View file

@ -32,13 +32,7 @@ let
If only one exists, the path for that one is returned. If only one exists, the path for that one is returned.
Otherwise a module is generated which contains both import paths. Otherwise a module is generated which contains both import paths.
*/ */
xargNames = lib.unique (lib.folderList ./config [ "trusted modules" ] ++ lib.folderList ./config/trusted [ "pkgs" "tf" ]); xarg = lib.recursiveMod { folder = ./config; inherit sources lib; };
xarg = (lib.mapListToAttrs
(folder: lib.nameValuePair folder (lib.domainMerge {
inherit folder;
folderPaths = [ (./config + "/${folder}") (./config/trusted + "/${folder}") ];
}))
xargNames) // { modules = lib.recursiveMod { folder = ./config/modules; inherit sources; }; };
/* /*
We provide the runners with this file this way. We also provide our nix args here. We provide the runners with this file this way. We also provide our nix args here.
This is also where pkgs are passed through to the meta config. This is also where pkgs are passed through to the meta config.

View file

@ -89,10 +89,10 @@
"homepage": null, "homepage": null,
"owner": "kittywitch", "owner": "kittywitch",
"repo": "nixexprs", "repo": "nixexprs",
"rev": "da3150b0837cf75c0c0fe36369ce424b80ee18ce", "rev": "05050726c147903a257c03bc454250cf0cb6b997",
"sha256": "0w43bih23d3iv95k4arm3xys679rr7rblr5a74isvzxz0m70w3kr", "sha256": "0fk4fyxvc4kivd5g6nnxrrwll51innx1dlx7wq7mvaarlm9vj5h0",
"type": "tarball", "type": "tarball",
"url": "https://github.com/kittywitch/nixexprs/archive/da3150b0837cf75c0c0fe36369ce424b80ee18ce.tar.gz", "url": "https://github.com/kittywitch/nixexprs/archive/05050726c147903a257c03bc454250cf0cb6b997.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}, },
"niv": { "niv": {

@ -1 +1 @@
Subproject commit da3150b0837cf75c0c0fe36369ce424b80ee18ce Subproject commit 05050726c147903a257c03bc454250cf0cb6b997

View file

@ -68,9 +68,11 @@ with lib; pkgs.mkShell {
nf-actions nf-actions
nf-actions-test nf-actions-test
] ++ config.runners.lazy.nativeBuildInputs ] ++ config.runners.lazy.nativeBuildInputs
++ (map (node: writeShellScriptBin "${node.networking.hostName}-img" '' ++ (map
(node: writeShellScriptBin "${node.networking.hostName}-img" ''
nix build -f . network.nodes.${node.networking.hostName}.system.build.sdImage --show-trace nix build -f . network.nodes.${node.networking.hostName}.system.build.sdImage --show-trace
'') (filter (node: node.system.build ? sdImage) (attrValues meta.network.nodes))); '')
(filter (node: node.system.build ? sdImage) (attrValues meta.network.nodes)));
shellHook = '' shellHook = ''
export HOME_HOSTNAME=$(hostname -s) export HOME_HOSTNAME=$(hostname -s)
export HOME_UID=$(id -u) export HOME_UID=$(id -u)