a lot of shuffling things around

This commit is contained in:
ChaotiCryptidz 2021-12-26 14:07:09 +00:00
parent a98539b9cc
commit 5d5ca6ef1c
35 changed files with 282 additions and 338 deletions

View file

@ -7,6 +7,5 @@
deploy-rs.url = "github:serokell/deploy-rs"; deploy-rs.url = "github:serokell/deploy-rs";
}; };
outputs = { ... }@inputs: import ./outputs.nix inputs; outputs = { ... }@inputs: import ./outputs.nix inputs;
} }

View file

@ -1,7 +1,7 @@
{ ... }: { { ... }: {
programs.zsh = { programs.zsh = {
enable = true; enable = true;
ohMyZsh = { oh-my-zsh = {
enable = true; enable = true;
theme = "afowler"; theme = "afowler";
plugins = [ ]; plugins = [ ];

View file

@ -1,5 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }: {
environment.systemPackages = with pkgs; [ home.packages = with pkgs; [
zip zip
unzip unzip
p7zip p7zip
@ -12,6 +12,6 @@
bzip2 bzip2
squashfsTools squashfsTools
cpio cpio
lz4 lz4
]; ];
} }

View file

@ -4,10 +4,6 @@
package = pkgs.gitAndTools.gitFull; package = pkgs.gitAndTools.gitFull;
userName = "ChaotiCryptidz"; userName = "ChaotiCryptidz";
userEmail = "chaoticryptidz@owo.monster"; userEmail = "chaoticryptidz@owo.monster";
extraConfig = { extraConfig = { credential = { helper = "store"; }; };
credential = {
helper = "store";
};
};
}; };
} }

12
home/gaming/gaming.nix Normal file
View file

@ -0,0 +1,12 @@
{ config, pkgs, ... }: {
home.packages = with pkgs; [
steam
lutris
mgba
nestopia
snes9x-gtk
melonDS
sixpair
xboxdrv
];
}

View file

@ -3,12 +3,6 @@
{ {
programs.vscode = { programs.vscode = {
enable = true; enable = true;
extensions = with pkgs; [
vscode-extensions.bbenoist.nix
vscode-extensions.brettm12345.nixfmt-vscode
vscode-extensions.tiehuis.zig
vscode-extensions.golang.go
];
userSettings = { userSettings = {
"window.zoomLevel" = -1; "window.zoomLevel" = -1;
"editor.fontSize" = 24; "editor.fontSize" = 24;
@ -19,7 +13,6 @@
"markdown.preview.fontFamily" = "'Comic Code'"; "markdown.preview.fontFamily" = "'Comic Code'";
"terminal.integrated.fontFamily" = "'Comic Code'"; "terminal.integrated.fontFamily" = "'Comic Code'";
"files.autoSave" = "afterDelay"; "files.autoSave" = "afterDelay";
"[nix]" = { "editor.defaultFormatter" = "brettm12345.nixfmt-vscode"; };
}; };
}; };
} }

View file

@ -0,0 +1,6 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [ go gopls go-outline goimports ];
programs.vscode.extensions = with pkgs; [ vscode-extensions.golang.go ];
}

View file

@ -0,0 +1,14 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [ nixfmt ];
programs.vscode.extensions = with pkgs; [
vscode-extensions.bbenoist.nix
vscode-extensions.brettm12345.nixfmt-vscode
];
programs.vscode.userSettings."[nix]" = {
"editor.defaultFormatter" = "brettm12345.nixfmt-vscode";
};
}

View file

@ -0,0 +1,6 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [ zig zls ];
programs.vscode.extensions = with pkgs; [ vscode-extensions.tiehuis.zig ];
}

View file

@ -1,9 +1,8 @@
{ pkgs, ... }: { { pkgs, ... }: {
environment.systemPackages = with pkgs; [ home.packages = with pkgs; [
binwalk binwalk
file file
binutils # strings binutils # strings
diffoscope diffoscope
]; ];
} }

View file

@ -35,143 +35,130 @@
GPG_TTY \ GPG_TTY \
NIX_PATH \ NIX_PATH \
SHLVL SHLVL
systemctl --user import-environment
#exec systemctl --user start sway.service
exec env --unset=SHLVL systemd-cat -t sway -- sway exec env --unset=SHLVL systemd-cat -t sway -- sway
fi fi
''; '';
programs.waybar = {
programs.waybar = { enable = true;
enable = true; settings = [{
# style = ''
# * {
# font-family: Iosevka;
# }
# '';
settings = [{
position = "bottom"; position = "bottom";
modules-left = [ ]; modules-left = [ ];
modules-center = [ ]; modules-center = [ ];
modules-right = [ "tray" ]; modules-right = [ "tray" ];
}]; }];
}; };
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
wrapperFeatures.base = true; wrapperFeatures.base = true;
wrapperFeatures.gtk = true; wrapperFeatures.gtk = true;
config = config = let
let terminal = "${pkgs.kitty}/bin/kitty";
terminal = "${pkgs.kitty}/bin/kitty"; menu = "${pkgs.wofi}/bin/wofi -idbt ${pkgs.kitty}/bin/kitty -p '' -W 25%";
menu = "${pkgs.wofi}/bin/wofi -idbt ${pkgs.kitty}/bin/kitty -p '' -W 25%"; cfg = config.wayland.windowManager.sway.config;
cfg = config.wayland.windowManager.sway.config; in {
in bars = [
{ {
position = "top";
fonts = {
names = [ "Comic Code" ];
bars = [ size = 14.0;
{
position = "top";
fonts = {
names = [ "Comic Code" ];
size = 14.0;
};
statusCommand = lib.escapeShellArgs [
#"/home/chaoticryptidz/Projects/gobar/gobar "
"${pkgs.gobar}/bin/gobar"
"cpu\\|mem\\|weather\\(Leighton\\ Buzzard\\)\\|bat\\(BAT0\\)\\|time"
];
}
{
command = "${pkgs.waybar}/bin/waybar";
}
];
input = {
"*" = {
xkb_layout = "gb";
}; };
}; statusCommand = lib.escapeShellArgs [
#"/home/chaoticryptidz/Projects/gobar/gobar "
"${pkgs.gobar}/bin/gobar"
"cpu\\|mem\\|weather\\(Leighton\\ Buzzard\\)\\|bat\\(BAT0\\)\\|time"
];
fonts = { }
names = [ "Comic Code" ]; { command = "${pkgs.waybar}/bin/waybar"; }
size = 18.0; ];
};
modifier = "Mod1"; input = { "*" = { xkb_layout = "gb"; }; };
terminal = "${pkgs.kitty}/bin/kitty";
startup = [ fonts = {
# gets blueman applet working for some reason names = [ "Comic Code" ];
{ command = "dbus-update-activation-environment DISPLAY"; always = true; } size = 18.0;
{ command = "nm-applet"; always = true; }
];
seat = {
"*" = {
"xcursor_theme" = "Adwaita 24";
};
};
gaps = {
top = 10;
bottom = 10;
left = 10;
right = 10;
inner = 20;
outer = 20;
smartGaps = true;
};
window = {
border = 4;
titlebar = false;
};
keybindings = {
"${cfg.modifier}+Return" = "exec ${cfg.terminal}";
"${cfg.modifier}+Left" = "focus left";
"${cfg.modifier}+Down" = "focus down";
"${cfg.modifier}+Up" = "focus up";
"${cfg.modifier}+Right" = "focus right";
"${cfg.modifier}+Shift+Left" = "move left";
"${cfg.modifier}+Shift+Down" = "move down";
"${cfg.modifier}+Shift+Up" = "move up";
"${cfg.modifier}+Shift+Right" = "move right";
"${cfg.modifier}+Shift+space" = "floating toggle";
"${cfg.modifier}+space" = "focus mode_toggle";
"XF86AudioRaiseVolume" = "exec pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') +5%";
"XF86AudioLowerVolume" = "exec pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') -5%";
"XF86AudioMute" = "exec pactl set-sink-mute $(pacmd list-sinks |awk '/* index:/{print $3}') toggle";
"XF86AudioMicMute" = "exec pactl set-source-mute $(pacmd list-sources |awk '/* index:/{print $3}') toggle";
"XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5";
"XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5";
"Print" = "exec ${pkgs.grim}/bin/grim -t png - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png";
"Shift+Print" = "exec ${pkgs.grim}/bin/grim -t png -g \"$(${pkgs.slurp}/bin/slurp -d)\" - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png";
"${cfg.modifier}+d" = "exec ${cfg.menu}";
"${cfg.modifier}+f" = "fullscreen";
"${cfg.modifier}+Shift+q" = "kill";
"${cfg.modifier}+Shift+c" = "reload";
"${cfg.modifier}+r" = "mode resize";
} // (lib.foldl lib.recursiveUpdate { } (map
(workspace: {
"${cfg.modifier}+${workspace}" = "workspace ${workspace}";
"${cfg.modifier}+Shift+${workspace}" = "move container to workspace ${workspace}";
}) [ "1" "2" "3" "4" "5" "6" "7" "8" "9" ]));
}; };
modifier = "Mod1";
terminal = "${pkgs.kitty}/bin/kitty";
startup = [
# gets blueman applet working for some reason
{
command = "dbus-update-activation-environment DISPLAY";
always = true;
}
{
command = "nm-applet";
always = true;
}
];
seat = { "*" = { "xcursor_theme" = "Adwaita 24"; }; };
gaps = {
top = 10;
bottom = 10;
left = 10;
right = 10;
inner = 20;
outer = 20;
smartGaps = true;
};
window = {
border = 4;
titlebar = false;
};
keybindings = {
"${cfg.modifier}+Return" = "exec ${cfg.terminal}";
"${cfg.modifier}+Left" = "focus left";
"${cfg.modifier}+Down" = "focus down";
"${cfg.modifier}+Up" = "focus up";
"${cfg.modifier}+Right" = "focus right";
"${cfg.modifier}+Shift+Left" = "move left";
"${cfg.modifier}+Shift+Down" = "move down";
"${cfg.modifier}+Shift+Up" = "move up";
"${cfg.modifier}+Shift+Right" = "move right";
"${cfg.modifier}+Shift+space" = "floating toggle";
"${cfg.modifier}+space" = "focus mode_toggle";
"XF86AudioRaiseVolume" =
"exec pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') +5%";
"XF86AudioLowerVolume" =
"exec pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') -5%";
"XF86AudioMute" =
"exec pactl set-sink-mute $(pacmd list-sinks |awk '/* index:/{print $3}') toggle";
"XF86AudioMicMute" =
"exec pactl set-source-mute $(pacmd list-sources |awk '/* index:/{print $3}') toggle";
"XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5";
"XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5";
"Print" =
"exec ${pkgs.grim}/bin/grim -t png - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png";
"Shift+Print" = ''
exec ${pkgs.grim}/bin/grim -t png -g "$(${pkgs.slurp}/bin/slurp -d)" - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png'';
"${cfg.modifier}+d" = "exec ${cfg.menu}";
"${cfg.modifier}+f" = "fullscreen";
"${cfg.modifier}+Shift+q" = "kill";
"${cfg.modifier}+Shift+c" = "reload";
"${cfg.modifier}+r" = "mode resize";
} // (lib.foldl lib.recursiveUpdate { } (map (workspace: {
"${cfg.modifier}+${workspace}" = "workspace ${workspace}";
"${cfg.modifier}+Shift+${workspace}" =
"move container to workspace ${workspace}";
}) [ "1" "2" "3" "4" "5" "6" "7" "8" "9" ]));
};
}; };
} }

View file

@ -1,21 +1,16 @@
{ home-manager, nixpkgs, tree, ... }@inputs: { home-manager, nixpkgs, tree, ... }@inputs:
let let
defaultModules = [ defaultModules =
home-manager.nixosModules.home-manager [ home-manager.nixosModules.home-manager tree.impure.profiles.base ];
tree.impure.profiles.base
];
defaultSpecialArgs = { defaultSpecialArgs = {
tree = tree.impure; tree = tree.impure;
pureTree = tree.pure; pureTree = tree.pure;
inherit inputs; inherit inputs;
}; };
in in {
{
lappy = nixpkgs.lib.nixosSystem { lappy = nixpkgs.lib.nixosSystem {
specialArgs = defaultSpecialArgs; specialArgs = defaultSpecialArgs;
system = "x86_64-linux"; system = "x86_64-linux";
modules = defaultModules ++ [ modules = defaultModules ++ [ ./lappy.nix ];
./lappy.nix
];
}; };
} }

View file

@ -15,18 +15,23 @@
profiles.gaming profiles.gaming
]; ];
config.home-manager.users.root = { imports = with tree; [ home.base ]; };
config.home-manager.users.chaoticryptidz = { config.home-manager.users.chaoticryptidz = {
imports = with tree; [ imports = with tree; [
home.base
home.gui home.gui
home.dev home.gaming
home.dev home.dev
home.network_manager home.network_manager
home.sway home.sway
home.vscode home.reversing
home.programming
home.programming.languages.go
home.programming.languages.nix
]; ];
}; };
config.networking.hostName = "lappy"; config.networking.hostName = "lappy";
config.time.timeZone = "Europe/London"; config.time.timeZone = "Europe/London";
config.powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; config.powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
@ -36,7 +41,8 @@
systemd-boot.enable = true; systemd-boot.enable = true;
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
}; };
initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; initrd.availableKernelModules =
[ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
kernelModules = [ "kvm-intel" ]; kernelModules = [ "kvm-intel" ];
}; };

View file

@ -8,10 +8,10 @@ let
"profiles/*".functor.enable = true; "profiles/*".functor.enable = true;
"users/*".functor.enable = true; "users/*".functor.enable = true;
"home/*".functor.enable = true; "home/*".functor.enable = true;
"home/programming/languages/*".functor.enable = true;
}; };
}; };
in in {
{
legacyPackages.tree = tree; legacyPackages.tree = tree;
nixosConfigurations = import ./hosts { nixosConfigurations = import ./hosts {
nixosSystem = nixpkgs.lib.nixosSystem; nixosSystem = nixpkgs.lib.nixosSystem;

View file

@ -1,7 +1,9 @@
{ fetchzip }: fetchzip { { fetchzip }:
fetchzip {
name = "comic-code-1.0"; name = "comic-code-1.0";
url = "https://cdn.discordapp.com/attachments/780878889924165652/919700644347142214/COCOD.ZIP"; url =
"https://cdn.discordapp.com/attachments/780878889924165652/919700644347142214/COCOD.ZIP";
sha256 = "sha256-MzEkMAopjpQBk24nRVDAtGNeF6f61XGww4rya2cU8TU="; sha256 = "sha256-MzEkMAopjpQBk24nRVDAtGNeF6f61XGww4rya2cU8TU=";
postFetch = '' postFetch = ''

View file

@ -1,4 +1,5 @@
{ stdenv, fetchFromGitLab, buildGoModule, lib, go }: buildGoModule rec { { stdenv, fetchFromGitLab, buildGoModule, lib, go }:
buildGoModule rec {
pname = "gobar"; pname = "gobar";
version = "latest-1"; version = "latest-1";

View file

@ -1,4 +1,5 @@
{ stdenv, fetchFromGitLab, lib, zig }: stdenv.mkDerivation rec { { stdenv, fetchFromGitLab, lib, zig }:
stdenv.mkDerivation rec {
pname = "zar"; pname = "zar";
version = "latest-1"; version = "latest-1";

View file

@ -1,8 +1,4 @@
{ tree, config, lib, pkgs, ... }: { { tree, config, lib, pkgs, ... }: {
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
security.sudo.wheelNeedsPassword = lib.mkForce false; security.sudo.wheelNeedsPassword = lib.mkForce false;
imports = with tree; [
home.base
];
} }

View file

@ -1,4 +1,5 @@
{ inputs, tree, config, lib, ... }: with lib; { { inputs, tree, config, lib, ... }:
with lib; {
options.home-manager.users = mkOption { options.home-manager.users = mkOption {
type = types.attrsOf (types.submoduleWith { type = types.attrsOf (types.submoduleWith {
modules = [ ]; modules = [ ];

View file

@ -1,19 +1,14 @@
{ inputs, config, lib, ... }: { { inputs, config, lib, ... }: {
nix = { nix = {
nixPath = [ nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
"nixpkgs=${inputs.nixpkgs}" extraOptions = lib.optionalString
]; (lib.versionAtLeast config.nix.package.version "2.4") ''
extraOptions = lib.optionalString (lib.versionAtLeast config.nix.package.version "2.4") '' experimental-features = nix-command flakes
experimental-features = nix-command flakes '';
'';
trustedUsers = [ "root" "@wheel" ]; trustedUsers = [ "root" "@wheel" ];
}; };
nixpkgs = { nixpkgs = {
config = { config = { allowUnfree = true; };
allowUnfree = true; overlays = [ (import ../../overlay) ];
};
overlays = [
(import ../../overlay)
];
}; };
} }

View file

@ -1,3 +1 @@
{ config, ... }: { { config, ... }: { programs.mtr.enable = true; }
programs.mtr.enable = true;
}

View file

@ -1,4 +1,2 @@
{ config, ... }: { { config, ... }: { services.localtime.enable = true; }
services.localtime.enable = true;
}

View file

@ -1,6 +1 @@
{ pkgs, ... }: { { pkgs, ... }: { environment.systemPackages = with pkgs; [ gdb lldb ]; }
environment.systemPackages = with pkgs; [
gdb
lldb
];
}

View file

@ -1,5 +1 @@
{ pkgs, ... }: { { pkgs, ... }: { environment.systemPackages = with pkgs; [ nano ]; }
environment.systemPackages = with pkgs; [
nano
];
}

View file

@ -1,10 +1,3 @@
{ pkgs, ... }: { { pkgs, ... }: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ jq ripgrep fd pv tmux socat ];
jq
ripgrep
fd
pv
tmux
socat
];
} }

View file

@ -1,7 +1,3 @@
{ pkgs, ... }: { { pkgs, ... }: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ neofetch inxi htop ];
neofetch
inxi
htop
];
} }

View file

@ -1,14 +0,0 @@
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [
# Nix
nixfmt
# Go
go
gopls
go-outline
goimports
# Zig
zig
zls
];
}

View file

@ -1,7 +1,3 @@
{ pkgs, ... }: { { pkgs, ... }: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ git darcs subversion ];
git
darcs
subversion
];
} }

View file

@ -1,13 +1,3 @@
{ pkgs, ... }: { { pkgs, ... }: {
programs.steam.enable = true; programs.steam.enable = true;
environment.systemPackages = with pkgs; [
steam
lutris
mgba
nestopia
snes9x-gtk
melonDS
sixpair
xboxdrv
];
} }

View file

@ -1,8 +1,5 @@
{ config, pkgs, ... }: { { config, pkgs, ... }: {
fonts.fonts = with pkgs; [ fonts.fonts = with pkgs; [ comic-neue comic-code ];
comic-neue
comic-code
];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
tdesktop tdesktop

View file

@ -2,9 +2,7 @@
networking = { networking = {
networkmanager = { networkmanager = {
enable = true; enable = true;
connectionConfig = { connectionConfig = { "ipv6.ip6-privacy" = lib.mkForce 0; };
"ipv6.ip6-privacy" = lib.mkForce 0;
};
}; };
}; };
programs.nm-applet.enable = true; programs.nm-applet.enable = true;

View file

@ -6,11 +6,7 @@
support32Bit = true; support32Bit = true;
extraModules = with pkgs; [ pkgs.pulseaudio-modules-bt ]; extraModules = with pkgs; [ pkgs.pulseaudio-modules-bt ];
package = pkgs.pulseaudioFull; package = pkgs.pulseaudioFull;
extraConfig = " extraConfig = "\n load-module module-switch-on-connect\n ";
load-module module-switch-on-connect
";
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ pavucontrol ];
pavucontrol
];
} }

View file

@ -2,6 +2,6 @@
programs.sway.enable = true; programs.sway.enable = true;
programs.xwayland.enable = true; programs.xwayland.enable = true;
services.xserver.enable = true; services.xserver.enable = true;
systemd.services.display-manager.enable = true; #systemd.services.display-manager.enable = true;
services.xserver.displayManager.sddm.enable = true; #services.xserver.displayManager.sddm.enable = true;
} }

171
tree.nix
View file

@ -1,4 +1,7 @@
{ lib }: { config, folder, inputs, ... }@args: with lib; let { lib }:
{ config, folder, inputs, ... }@args:
with lib;
let
# Made by kat witch (kittywitch) # Made by kat witch (kittywitch)
pureTreeGrab = { base, path }: pureTreeGrab = { base, path }:
let let
@ -9,135 +12,127 @@
isDir = entry: _: (isDirectory entry) && !(isHidden entry); isDir = entry: _: (isDirectory entry) && !(isHidden entry);
directories = filterAttrs isDir dirContents; directories = filterAttrs isDir dirContents;
isNixFile = entry: _: isNixFile = entry: _:
let let result = builtins.match "(.*)\\.nix" entry;
result = builtins.match "(.*)\\.nix" entry; in result != null && builtins.length result > 0;
in
result != null && builtins.length result > 0;
nixFiles = filterAttrs isNixFile dirContents; nixFiles = filterAttrs isNixFile dirContents;
getPath = entry: "${realPath}/${entry}"; getPath = entry: "${realPath}/${entry}";
getPaths = entries: mapAttrs' getPaths = entries:
(n: v: mapAttrs' (n: v: nameValuePair (removeSuffix ".nix" n) (getPath n))
nameValuePair (removeSuffix ".nix" n) (getPath n)
)
entries; entries;
nixFilePaths = getPaths nixFiles; nixFilePaths = getPaths nixFiles;
dirPaths = getPaths directories; dirPaths = getPaths directories;
recursedPaths = mapAttrs recursedPaths = mapAttrs (_: fullPath:
(_: fullPath: pureTreeGrab { pureTreeGrab {
inherit base; inherit base;
path = fullPath; path = fullPath;
}) }) dirPaths;
dirPaths;
contents = recursedPaths // nixFilePaths; contents = recursedPaths // nixFilePaths;
in in contents;
contents;
configTreeStruct = { config, ... }: { configTreeStruct = { config, ... }: {
options.treeConfig = mkOption { options.treeConfig = mkOption {
type = with types; attrsOf (submodule ({ name, options, config, ... }: { type = with types;
options = { attrsOf (submodule ({ name, options, config, ... }: {
evaluateDefault = mkOption { options = {
type = types.bool; evaluateDefault = mkOption {
description = "Replace the contents of this branch or leaf with those provided by the evaluation of default.nix.";
default = false;
};
aliasDefault = mkOption {
type = types.bool;
description = "Replace the contents of this branch or leaf with the default.nix.";
default = false;
};
excludes = mkOption {
type = types.listOf types.str;
description = "Exclude files or folders from the recurser.";
default = [ ];
};
functor = {
enable = mkOption {
type = types.bool; type = types.bool;
description = "Provide a functor for the path provided"; description =
"Replace the contents of this branch or leaf with those provided by the evaluation of default.nix.";
default = false; default = false;
}; };
external = mkOption { aliasDefault = mkOption {
type = types.listOf types.unspecified; type = types.bool;
description = "Add external imports into the functor."; description =
default = [ ]; "Replace the contents of this branch or leaf with the default.nix.";
default = false;
}; };
excludes = mkOption { excludes = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
description = "Exclude files or folders from the functor."; description = "Exclude files or folders from the recurser.";
default = [ ]; default = [ ];
}; };
functor = {
enable = mkOption {
type = types.bool;
description = "Provide a functor for the path provided";
default = false;
};
external = mkOption {
type = types.listOf types.unspecified;
description = "Add external imports into the functor.";
default = [ ];
};
excludes = mkOption {
type = types.listOf types.str;
description = "Exclude files or folders from the functor.";
default = [ ];
};
};
}; };
}; }));
}));
};
config.treeConfig = {
"*" = { };
}; };
config.treeConfig = { "*" = { }; };
}; };
configTree.treeConfig = config; configTree.treeConfig = config;
configTreeModule = (evalModules { configTreeModule = (evalModules {
modules = [ modules = [ configTreeStruct configTree ];
configTreeStruct
configTree
];
}).config.treeConfig; }).config.treeConfig;
mapAttrsRecursive = f: set: mapAttrsRecursive = f: set:
let let
recurse = path: set: recurse = path: set:
let let
g = name: value: g = name: value:
if isAttrs value if isAttrs value then
then f (path ++ [ name ]) (recurse (path ++ [ name ]) value) f (path ++ [ name ]) (recurse (path ++ [ name ]) value)
else f (path ++ [ name ]) value; else
in f (path ++ [ name ]) value;
mapAttrs g set; in mapAttrs g set;
in in recurse [ ] set;
recurse [ ] set;
getPathString = path: concatStringsSep "/" path; getPathString = path: concatStringsSep "/" path;
getConfig = path: default: configTreeModule.${getPathString path} or default; getConfig = path: default: configTreeModule.${getPathString path} or default;
revtail = path: sublist 0 (length path - 1) path; revtail = path: sublist 0 (length path - 1) path;
getConfigRecursive = path: getConfigRecursive = path:
let let parentPath = revtail path;
parentPath = revtail path; in getConfig (path ++ singleton "*") (getConfigRecursive parentPath);
in processLeaves = tree: config:
getConfig (path ++ singleton "*") (getConfigRecursive parentPath); mapAttrsRecursive (path: value:
processLeaves = tree: config: mapAttrsRecursive
(path: value:
let let
pathString = getPathString path; pathString = getPathString path;
leafConfig = getConfig path (getConfigRecursive (revtail path)); leafConfig = getConfig path (getConfigRecursive (revtail path));
processConfig = path: value: processConfig = path: value:
let let
processFunctor = prev: prev // { processFunctor = prev:
__functor = self: { ... }: { prev // {
imports = attrValues (removeAttrs prev leafConfig.functor.excludes) ++ leafConfig.functor.external; __functor = self:
{ ... }: {
imports =
attrValues (removeAttrs prev leafConfig.functor.excludes)
++ leafConfig.functor.external;
};
}; };
};
processAliasDefault = prev: prev.default; processAliasDefault = prev: prev.default;
processDefault = prev: import prev.default (args // { processDefault = prev:
inherit lib; import prev.default (args // {
tree = { inherit lib;
prev = removeAttrs prev (singleton "default"); tree = {
pure = pureTree; prev = removeAttrs prev (singleton "default");
impure = impureTree; pure = pureTree;
}; impure = impureTree;
}); };
});
processExcludes = prev: removeAttrs prev leafConfig.excludes; processExcludes = prev: removeAttrs prev leafConfig.excludes;
processes = optionals (isAttrs value) ( processes = optionals (isAttrs value)
optional (leafConfig.excludes != [ ]) processExcludes (optional (leafConfig.excludes != [ ]) processExcludes
++ optional leafConfig.evaluateDefault processDefault ++ optional leafConfig.evaluateDefault processDefault
++ optional leafConfig.aliasDefault processAliasDefault ++ optional leafConfig.aliasDefault processAliasDefault
++ optional leafConfig.functor.enable processFunctor ++ optional leafConfig.functor.enable processFunctor);
); in pipe value processes;
in in processConfig path value) tree;
pipe value processes; pureTree = pureTreeGrab {
in base = folder;
processConfig path value) path = folder;
tree; };
pureTree = pureTreeGrab { base = folder; path = folder; };
impureTree = processLeaves pureTree configTreeModule; impureTree = processLeaves pureTree configTreeModule;
in in {
{
config = configTreeModule; config = configTreeModule;
pure = pureTree; pure = pureTree;
impure = impureTree; impure = impureTree;

View file

@ -1,6 +1,7 @@
{ config, ... }: { { config, ... }: {
users.users.chaoticryptidz = { users.users.chaoticryptidz = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" "video" "systemd-journal" "plugdev" "vfio" "input" "uinput" ]; extraGroups =
[ "wheel" "video" "systemd-journal" "plugdev" "vfio" "input" "uinput" ];
}; };
} }