From d89b38c29e67f940ecbca21948d8b43e672feb05 Mon Sep 17 00:00:00 2001 From: ChaotiCryptidz Date: Tue, 21 Dec 2021 15:26:21 +0000 Subject: [PATCH] Formatting. --- home/gui/qt.nix | 2 +- home/nixos.nix | 2 +- home/sway/kitty.nix | 2 +- home/sway/sway.nix | 97 ++++++++++++-------- home/vscode/code.nix | 26 +++--- hosts/default.nix | 6 +- outputs.nix | 6 +- overlay/comic-code/default.nix | 2 +- profiles/base/nix.nix | 2 +- profiles/dev/default.nix | 6 +- profiles/dnscrypt/dnscrypt.nix | 2 +- profiles/network_manager/nm.nix | 2 +- tree.nix | 152 ++++++++++++++++++-------------- 13 files changed, 179 insertions(+), 128 deletions(-) diff --git a/home/gui/qt.nix b/home/gui/qt.nix index 07d0a16..149721b 100644 --- a/home/gui/qt.nix +++ b/home/gui/qt.nix @@ -9,4 +9,4 @@ package = pkgs.adwaita-qt; }; }; -} \ No newline at end of file +} diff --git a/home/nixos.nix b/home/nixos.nix index fcb90a8..4a05ed2 100644 --- a/home/nixos.nix +++ b/home/nixos.nix @@ -1,6 +1,6 @@ { config, ... }: { users.users.chaoticryptidz = { isNormalUser = true; - extraGroups = [ "wheel" ]; + extraGroups = [ "wheel" "video" "systemd-journal" "plugdev" "vfio" "input" "uinput" ]; }; } diff --git a/home/sway/kitty.nix b/home/sway/kitty.nix index 1827304..f01d2c5 100644 --- a/home/sway/kitty.nix +++ b/home/sway/kitty.nix @@ -16,4 +16,4 @@ disable_ligatures = "cursor"; }; }; -} \ No newline at end of file +} diff --git a/home/sway/sway.nix b/home/sway/sway.nix index 42207af..c785682 100644 --- a/home/sway/sway.nix +++ b/home/sway/sway.nix @@ -3,9 +3,22 @@ XDG_CURRENT_DESKTOP = "sway"; XDG_SESSION_TYPE = "wayland"; WLR_DRM_DEVICES = "/dev/dri/card0"; + SDL_VIDEODRIVER = "wayland"; + QT_QPA_PLATFORM = "wayland"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = 1; + _JAVA_AWT_WM_NONREPARENTING = 1; }; - home.packages = with pkgs; [ grim slurp wl-clipboard jq wofi wmctrl ]; + home.packages = with pkgs; [ + grim + slurp + wl-clipboard + jq + wofi + wmctrl + libnotify + light + ]; programs.zsh.profileExtra = '' # If running from tty1 start sway @@ -24,26 +37,28 @@ fi ''; - programs.mako = { - enable = true; - defaultTimeout = 3000; - }; + programs.mako = { + enable = true; + defaultTimeout = 3000; + }; - wayland.windowManager.sway = { - enable = true; - config = let + wayland.windowManager.sway = { + enable = true; + config = + let terminal = "${pkgs.kitty}/bin/kitty"; menu = "${pkgs.wofi}/bin/wofi -idbt ${pkgs.kitty}/bin/kitty -p '' -W 25%"; cfg = config.wayland.windowManager.sway.config; - in { + in + { bars = [ - { - position = "top"; + { + position = "top"; fonts = { names = [ "Comic Code" ]; size = 18.0; }; - statusCommand = "${pkgs.zar}/bin/zar"; + statusCommand = "${pkgs.zar}/bin/zar"; } ]; @@ -57,7 +72,7 @@ names = [ "Comic Code" ]; size = 18.0; }; - + modifier = "Mod1"; terminal = "${pkgs.kitty}/bin/kitty"; @@ -65,6 +80,12 @@ { command = "systemctl --user restart mako"; always = true; } ]; + seat = { + "*" = { + "xcursor_theme" = "Adwaita 24"; + }; + }; + gaps = { top = 10; bottom = 10; @@ -112,32 +133,32 @@ "${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" ])); + } // (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" ])); }; - wrapperFeatures.gtk = true; - extraConfig = '' - seat seat0 xcursor_theme breeze_cursors 20 - bindswitch --reload --locked lid:on output eDP-1 disable - bindswitch --reload --locked lid:off output eDP-1 enable - ''; - }; - programs.waybar = { - enable = true; - style = '' - * { - font-family: "Comic Code"; - font-size: 20px; - } - ''; - settings = [{ - modules-left = [ "sway/workspaces" "sway/mode" ]; - modules-center = [ "sway/window" ]; - modules-right = [ "pulseaudio" "battery" "clock" "tray" ]; - }]; - }; + wrapperFeatures.gtk = true; + extraConfig = '' + bindswitch --reload --locked lid:on output eDP-1 disable + bindswitch --reload --locked lid:off output eDP-1 enable + ''; + }; + programs.waybar = { + enable = true; + style = '' + * { + font-family: "Comic Code"; + font-size: 20px; + } + ''; + settings = [{ + modules-left = [ "sway/workspaces" "sway/mode" ]; + modules-center = [ "sway/window" ]; + modules-right = [ "pulseaudio" "battery" "clock" "tray" ]; + }]; + }; } diff --git a/home/vscode/code.nix b/home/vscode/code.nix index 673ed90..dd34145 100644 --- a/home/vscode/code.nix +++ b/home/vscode/code.nix @@ -4,20 +4,20 @@ programs.vscode = { enable = true; extensions = with pkgs; [ - vscode-extensions.bbenoist.nix - vscode-extensions.tiehuis.zig - vscode-extensions.golang.go + vscode-extensions.bbenoist.nix + vscode-extensions.tiehuis.zig + vscode-extensions.golang.go ]; userSettings = { - "window.zoomLevel" = -1; - "editor.fontSize" = 24; - "editor.fontFamily" = "'Comic Code'"; - "terminal.integrated.fontSize" = 24; - "editor.codeLensFontFamily" = "'Comic Code'"; - "editor.inlayHints.fontFamily" = "'Comic Code'"; - "markdown.preview.fontFamily" = "'Comic Code'"; - "terminal.integrated.fontFamily" = "'Comic Code'"; - "files.autoSave" = "afterDelay"; + "window.zoomLevel" = -1; + "editor.fontSize" = 24; + "editor.fontFamily" = "'Comic Code'"; + "terminal.integrated.fontSize" = 24; + "editor.codeLensFontFamily" = "'Comic Code'"; + "editor.inlayHints.fontFamily" = "'Comic Code'"; + "markdown.preview.fontFamily" = "'Comic Code'"; + "terminal.integrated.fontFamily" = "'Comic Code'"; + "files.autoSave" = "afterDelay"; }; }; -} \ No newline at end of file +} diff --git a/hosts/default.nix b/hosts/default.nix index 4917d49..4d08f15 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,4 +1,5 @@ -{ home-manager, nixpkgs, tree, ... }@inputs: let +{ home-manager, nixpkgs, tree, ... }@inputs: +let defaultModules = [ home-manager.nixosModules.home-manager tree.impure.profiles.base @@ -8,7 +9,8 @@ pureTree = tree.pure; inherit inputs; }; -in { +in +{ lappy = nixpkgs.lib.nixosSystem { specialArgs = defaultSpecialArgs; system = "x86_64-linux"; diff --git a/outputs.nix b/outputs.nix index 3561d56..328ae72 100644 --- a/outputs.nix +++ b/outputs.nix @@ -1,4 +1,5 @@ -{ nixpkgs, home-manager, ... }@inputs: let +{ nixpkgs, home-manager, ... }@inputs: +let mkTree = import ./tree.nix { inherit (nixpkgs) lib; }; tree = mkTree { inherit inputs; @@ -9,7 +10,8 @@ "home/*".functor.enable = true; }; }; -in { +in +{ legacyPackages.tree = tree; nixosConfigurations = import ./hosts { nixosSystem = nixpkgs.lib.nixosSystem; diff --git a/overlay/comic-code/default.nix b/overlay/comic-code/default.nix index 96616d7..bd41884 100644 --- a/overlay/comic-code/default.nix +++ b/overlay/comic-code/default.nix @@ -1,5 +1,5 @@ { fetchzip }: fetchzip { - name="comic-code-1.0"; + name = "comic-code-1.0"; url = "https://cdn.discordapp.com/attachments/780878889924165652/919700644347142214/COCOD.ZIP"; sha256 = "sha256-MzEkMAopjpQBk24nRVDAtGNeF6f61XGww4rya2cU8TU="; diff --git a/profiles/base/nix.nix b/profiles/base/nix.nix index f1f7ceb..96be456 100644 --- a/profiles/base/nix.nix +++ b/profiles/base/nix.nix @@ -4,7 +4,7 @@ "nixpkgs=${inputs.nixpkgs}" ]; extraOptions = lib.optionalString (lib.versionAtLeast config.nix.package.version "2.4") '' - experimental-features = nix-command flakes + experimental-features = nix-command flakes ''; trustedUsers = [ "root" "@wheel" ]; }; diff --git a/profiles/dev/default.nix b/profiles/dev/default.nix index 75ac655..3e4903e 100644 --- a/profiles/dev/default.nix +++ b/profiles/dev/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{ pkgs, ... }: { environment.systemPackages = with pkgs; [ git nano @@ -6,5 +6,9 @@ wget jq ripgrep + fd + htop + dig + nixpkgs-fmt ]; } diff --git a/profiles/dnscrypt/dnscrypt.nix b/profiles/dnscrypt/dnscrypt.nix index e262551..20854e0 100644 --- a/profiles/dnscrypt/dnscrypt.nix +++ b/profiles/dnscrypt/dnscrypt.nix @@ -32,4 +32,4 @@ ]; }; }; -} \ No newline at end of file +} diff --git a/profiles/network_manager/nm.nix b/profiles/network_manager/nm.nix index bd8a938..5294b58 100644 --- a/profiles/network_manager/nm.nix +++ b/profiles/network_manager/nm.nix @@ -3,7 +3,7 @@ networkmanager = { enable = true; connectionConfig = { - "ipv6.ip6-privacy" = lib.mkForce 0; + "ipv6.ip6-privacy" = lib.mkForce 0; }; }; }; diff --git a/tree.nix b/tree.nix index 7884493..8b5f6fa 100644 --- a/tree.nix +++ b/tree.nix @@ -1,28 +1,36 @@ { lib }: { config, folder, inputs, ... }@args: with lib; let # Made by kat witch (kittywitch) - pureTreeGrab = { base, path }: let - realPath = toString path; - dirContents = builtins.readDir path; - isDirectory = entry: dirContents."${entry}" == "directory"; - isHidden = entry: hasPrefix "." entry; - isDir = entry: _: (isDirectory entry) && !(isHidden entry); - directories = filterAttrs isDir dirContents; - isNixFile = entry: _: let - result = builtins.match "(.*)\\.nix" entry; - in result != null && builtins.length result > 0; - nixFiles = filterAttrs isNixFile dirContents; - getPath = entry: "${realPath}/${entry}"; - getPaths = entries: mapAttrs' (n: v: - nameValuePair (removeSuffix ".nix" n) (getPath n) - ) entries; - nixFilePaths = getPaths nixFiles; - dirPaths = getPaths directories; - recursedPaths = mapAttrs (_: fullPath: pureTreeGrab { - inherit base; - path = fullPath; - }) dirPaths; - contents = recursedPaths // nixFilePaths; - in contents; + pureTreeGrab = { base, path }: + let + realPath = toString path; + dirContents = builtins.readDir path; + isDirectory = entry: dirContents."${entry}" == "directory"; + isHidden = entry: hasPrefix "." entry; + isDir = entry: _: (isDirectory entry) && !(isHidden entry); + directories = filterAttrs isDir dirContents; + isNixFile = entry: _: + let + result = builtins.match "(.*)\\.nix" entry; + in + result != null && builtins.length result > 0; + nixFiles = filterAttrs isNixFile dirContents; + getPath = entry: "${realPath}/${entry}"; + getPaths = entries: mapAttrs' + (n: v: + nameValuePair (removeSuffix ".nix" n) (getPath n) + ) + entries; + nixFilePaths = getPaths nixFiles; + dirPaths = getPaths directories; + recursedPaths = mapAttrs + (_: fullPath: pureTreeGrab { + inherit base; + path = fullPath; + }) + dirPaths; + contents = recursedPaths // nixFilePaths; + in + contents; configTreeStruct = { config, ... }: { options.treeConfig = mkOption { type = with types; attrsOf (submodule ({ name, options, config, ... }: { @@ -40,7 +48,7 @@ excludes = mkOption { type = types.listOf types.str; description = "Exclude files or folders from the recurser."; - default = []; + default = [ ]; }; functor = { enable = mkOption { @@ -51,19 +59,19 @@ external = mkOption { type = types.listOf types.unspecified; description = "Add external imports into the functor."; - default = []; + default = [ ]; }; excludes = mkOption { type = types.listOf types.str; description = "Exclude files or folders from the functor."; - default = []; + default = [ ]; }; }; }; })); }; config.treeConfig = { - "*" = {}; + "*" = { }; }; }; configTree.treeConfig = config; @@ -73,49 +81,63 @@ configTree ]; }).config.treeConfig; - mapAttrsRecursive = f: set: let - recurse = path: set: let - g = name: value: if isAttrs value - then f (path ++ [name]) (recurse (path ++ [name]) value) - else f (path ++ [name]) value; - in mapAttrs g set; - in recurse [] set; + mapAttrsRecursive = f: set: + let + recurse = path: set: + let + g = name: value: + if isAttrs value + then f (path ++ [ name ]) (recurse (path ++ [ name ]) value) + else f (path ++ [ name ]) value; + in + mapAttrs g set; + in + recurse [ ] set; getPathString = path: concatStringsSep "/" path; getConfig = path: default: configTreeModule.${getPathString path} or default; revtail = path: sublist 0 (length path - 1) path; - getConfigRecursive = path: let - parentPath = revtail path; - in getConfig (path ++ singleton "*") (getConfigRecursive parentPath); - processLeaves = tree: config: mapAttrsRecursive (path: value: let - pathString = getPathString path; - leafConfig = getConfig path (getConfigRecursive (revtail path)); - processConfig = path: value: let - processFunctor = prev: prev // { - __functor = self: { ... }: { - imports = attrValues (removeAttrs prev leafConfig.functor.excludes) ++ leafConfig.functor.external; - }; - }; - processAliasDefault = prev: prev.default; - processDefault = prev: import prev.default (args // { - inherit lib; - tree = { - prev = removeAttrs prev (singleton "default"); - pure = pureTree; - impure = impureTree; - }; - }); - processExcludes = prev: removeAttrs prev leafConfig.excludes; - processes = optionals (isAttrs value) ( - optional (leafConfig.excludes != []) processExcludes - ++ optional leafConfig.evaluateDefault processDefault - ++ optional leafConfig.aliasDefault processAliasDefault - ++ optional leafConfig.functor.enable processFunctor - ); - in pipe value processes; - in processConfig path value) tree; + getConfigRecursive = path: + let + parentPath = revtail path; + in + getConfig (path ++ singleton "*") (getConfigRecursive parentPath); + processLeaves = tree: config: mapAttrsRecursive + (path: value: + let + pathString = getPathString path; + leafConfig = getConfig path (getConfigRecursive (revtail path)); + processConfig = path: value: + let + processFunctor = prev: prev // { + __functor = self: { ... }: { + imports = attrValues (removeAttrs prev leafConfig.functor.excludes) ++ leafConfig.functor.external; + }; + }; + processAliasDefault = prev: prev.default; + processDefault = prev: import prev.default (args // { + inherit lib; + tree = { + prev = removeAttrs prev (singleton "default"); + pure = pureTree; + impure = impureTree; + }; + }); + processExcludes = prev: removeAttrs prev leafConfig.excludes; + processes = optionals (isAttrs value) ( + optional (leafConfig.excludes != [ ]) processExcludes + ++ optional leafConfig.evaluateDefault processDefault + ++ optional leafConfig.aliasDefault processAliasDefault + ++ optional leafConfig.functor.enable processFunctor + ); + in + pipe value processes; + in + processConfig path value) + tree; pureTree = pureTreeGrab { base = folder; path = folder; }; impureTree = processLeaves pureTree configTreeModule; -in { +in +{ config = configTreeModule; pure = pureTree; impure = impureTree;