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

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

View file

@ -20,8 +20,13 @@
"mmc_block"
"usbhid"
"ext4"
"hid_generic" "hid_lenovo" "hid_apple" "hid_roccat"
"hid_logitech_hidpp" "hid_logitech_dj" "hid_microsoft"
"hid_generic"
"hid_lenovo"
"hid_apple"
"hid_roccat"
"hid_logitech_hidpp"
"hid_logitech_dj"
"hid_microsoft"
];
};
};

View file

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

View file

@ -149,7 +149,8 @@ in
];
};
in mkIf cfg.enable {
in
mkIf cfg.enable {
programs.vim.package = vim;
home.packages = [ cfg.package ];
}

View file

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

View file

@ -72,7 +72,7 @@ with lib;
nixos = {
extraModules = [
"${toString sources.home-manager}/nixos"
] ++ singleton meta.modules.nixos;
] ++ lib.singleton meta.modules.nixos;
specialArgs = {
inherit (config.network) nodes;
inherit sources meta;

View file

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

View file

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

View file

@ -2,6 +2,7 @@
{
base16 = {
inherit (config.home-manager.users.kat.base16) schemes alias;
console = {
enable = true;
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 = {
root = "/var/lib/kat/secrets";
persistentRoot = "/var/lib/kat/secrets";

View file

@ -1,17 +1,13 @@
rec {
common = ./armvcommon.nix;
armv7-base = ./armv7.nix;
armv6-base = ./armv6.nix;
aarch64-base = ./aarch64.nix;
{ lib, tree, ... }: with lib; let
profiles = tree.dirs // tree.files;
appendedProfiles = with profiles; {
aarch64 = {
deploy.profile.cross = {
enable = true;
aarch64 = true;
};
imports = [
aarch64-base
aarch64
];
};
armv7l = {
@ -20,8 +16,8 @@ rec {
armv7l = true;
};
imports = [
common
armv7-base
arm-common
armv7
];
};
armv6l = {
@ -30,8 +26,10 @@ rec {
armv6l = true;
};
imports = [
common
armv6-base
arm-common
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 }:
let profiles = with profiles; lib.domainMerge
{
folder = ""; # not used in this usage
folderPaths = [
./.
../../trusted/profiles/hardware
];
} // {
{ lib, tree, ... }: with lib; let
profiles = (filterAttrs (n: v: v ? "default") tree.dirs)
// tree.defaultDirs
// (mapAttrs (n: v: removeAttrs v [ "default" ]) (filterAttrs (n: v: v ? "default") tree.dirs))
// tree.files;
appendedProfiles = with profiles; {
ms-7b86 = {
imports = [
ms-7b86-base
ms-7b86
ryzen
amdgpu
];
};
rm-310 = {
imports = [
rm-310-base
rm-310
intel
];
};
v330-14arr = {
imports = [
v330-14arr-base
v330-14arr
ryzen
amdgpu
laptop
@ -31,10 +28,11 @@ let hardwareProfiles = { lib }:
};
eeepc-1015pem = {
imports = [
eeepc-1015pem-base
eeepc-1015pem
intel
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;
imports = [
./light.nix
];
})
];
}

View file

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

View file

@ -1,26 +1,26 @@
rec {
common = ./common.nix;
ubuntu-base = ./ubuntu.nix;
oracle-base = ./oracle.nix;
ubuntu = {
{ lib, sources, tree, ... }: with lib; let
profiles = tree.dirs // tree.files;
appendedProfiles = with profiles; {
ubuntu = { config, ... }: {
deploy.profile.hardware.oracle = {
common = true;
ubuntu = true;
};
imports = [
common
ubuntu-base
];
};
oracle = {
deploy.profile.hardware.oracle = {
common = true;
oracle = true;
};
imports = [
imports = with import (sources.tf-nix + "/modules"); [
nixos.ubuntu-linux
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,4 +1,6 @@
{ config, pkgs, ... }:
{ ... }: {
imports = [
({ config, pkgs, ... }:
{
users.users.arc = {
@ -9,4 +11,6 @@
];
shell = pkgs.zsh;
};
})
];
}

View file

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

View file

@ -1,4 +1,6 @@
{ config, lib, pkgs, ... }:
{ ... }: {
imports = [
({ config, lib, pkgs, ... }:
{
users.users.hexchen = {
@ -35,4 +37,6 @@
programs.bat.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 }:
let
userImport = profile: { config, ... }: {
{ lib, tree, ... }: with lib; let
wrapImports = imports: mapAttrs
(name: paths: { config, ... }: {
config.home-manager.users.kat = {
imports = [
(./. + "/${profile}")
];
};
};
serviceImport = profile: { config, ... }: {
config.home-manager.users.kat = {
imports = [
(./services + "/${profile}")
];
};
};
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 ]; };
imports = if isAttrs paths then attrValues paths else singleton paths;
};
})
imports;
dirImports = wrapImports tree.dirs;
serviceImports = wrapImports tree.dirs.services;
in
userProfiles;
in { __functor = self: katUser; isModule = false; }
(removeAttrs dirImports (singleton "base")) // {
base = {
imports = [
dirImports.base
tree.files.nixos
];
};
server = { };
guiFull = {
imports = with dirImports; [
gui
sway
dev
media
personal
];
};
services = serviceImports;
}

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

@ -3,7 +3,7 @@
{
programs.neovim = {
extraConfig = ''
${source ./init.vim}
source ${./init.vim}
'';
plugins = with pkgs.vimPlugins; [
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.
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.mapListToAttrs
(folder: lib.nameValuePair folder (lib.domainMerge {
inherit folder;
folderPaths = [ (./config + "/${folder}") (./config/trusted + "/${folder}") ];
}))
xargNames) // { modules = lib.recursiveMod { folder = ./config/modules; inherit sources; }; };
xarg = lib.recursiveMod { folder = ./config; inherit sources lib; };
/*
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.

View file

@ -89,10 +89,10 @@
"homepage": null,
"owner": "kittywitch",
"repo": "nixexprs",
"rev": "da3150b0837cf75c0c0fe36369ce424b80ee18ce",
"sha256": "0w43bih23d3iv95k4arm3xys679rr7rblr5a74isvzxz0m70w3kr",
"rev": "05050726c147903a257c03bc454250cf0cb6b997",
"sha256": "0fk4fyxvc4kivd5g6nnxrrwll51innx1dlx7wq7mvaarlm9vj5h0",
"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"
},
"niv": {

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

View file

@ -68,9 +68,11 @@ with lib; pkgs.mkShell {
nf-actions
nf-actions-test
] ++ 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
'') (filter (node: node.system.build ? sdImage) (attrValues meta.network.nodes)));
'')
(filter (node: node.system.build ? sdImage) (attrValues meta.network.nodes)));
shellHook = ''
export HOME_HOSTNAME=$(hostname -s)
export HOME_UID=$(id -u)