Formatting.

This commit is contained in:
ChaotiCryptidz 2021-12-21 15:26:21 +00:00
parent 729a895f36
commit d89b38c29e
13 changed files with 179 additions and 128 deletions

View file

@ -9,4 +9,4 @@
package = pkgs.adwaita-qt; package = pkgs.adwaita-qt;
}; };
}; };
} }

View file

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

View file

@ -16,4 +16,4 @@
disable_ligatures = "cursor"; disable_ligatures = "cursor";
}; };
}; };
} }

View file

@ -3,9 +3,22 @@
XDG_CURRENT_DESKTOP = "sway"; XDG_CURRENT_DESKTOP = "sway";
XDG_SESSION_TYPE = "wayland"; XDG_SESSION_TYPE = "wayland";
WLR_DRM_DEVICES = "/dev/dri/card0"; 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 = '' programs.zsh.profileExtra = ''
# If running from tty1 start sway # If running from tty1 start sway
@ -24,26 +37,28 @@
fi fi
''; '';
programs.mako = { programs.mako = {
enable = true; enable = true;
defaultTimeout = 3000; defaultTimeout = 3000;
}; };
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
config = let config =
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 = [ bars = [
{ {
position = "top"; position = "top";
fonts = { fonts = {
names = [ "Comic Code" ]; names = [ "Comic Code" ];
size = 18.0; size = 18.0;
}; };
statusCommand = "${pkgs.zar}/bin/zar"; statusCommand = "${pkgs.zar}/bin/zar";
} }
]; ];
@ -57,7 +72,7 @@
names = [ "Comic Code" ]; names = [ "Comic Code" ];
size = 18.0; size = 18.0;
}; };
modifier = "Mod1"; modifier = "Mod1";
terminal = "${pkgs.kitty}/bin/kitty"; terminal = "${pkgs.kitty}/bin/kitty";
@ -65,6 +80,12 @@
{ command = "systemctl --user restart mako"; always = true; } { command = "systemctl --user restart mako"; always = true; }
]; ];
seat = {
"*" = {
"xcursor_theme" = "Adwaita 24";
};
};
gaps = { gaps = {
top = 10; top = 10;
bottom = 10; bottom = 10;
@ -112,32 +133,32 @@
"${cfg.modifier}+Shift+c" = "reload"; "${cfg.modifier}+Shift+c" = "reload";
"${cfg.modifier}+r" = "mode resize"; "${cfg.modifier}+r" = "mode resize";
} // (lib.foldl lib.recursiveUpdate {} (map (workspace: { } // (lib.foldl lib.recursiveUpdate { } (map
"${cfg.modifier}+${workspace}" = "workspace ${workspace}"; (workspace: {
"${cfg.modifier}+Shift+${workspace}" = "move container to workspace ${workspace}"; "${cfg.modifier}+${workspace}" = "workspace ${workspace}";
}) [ "1" "2" "3" "4" "5" "6" "7" "8" "9" ])); "${cfg.modifier}+Shift+${workspace}" = "move container to workspace ${workspace}";
}) [ "1" "2" "3" "4" "5" "6" "7" "8" "9" ]));
}; };
wrapperFeatures.gtk = true; wrapperFeatures.gtk = true;
extraConfig = '' extraConfig = ''
seat seat0 xcursor_theme breeze_cursors 20 bindswitch --reload --locked lid:on output eDP-1 disable
bindswitch --reload --locked lid:on output eDP-1 disable bindswitch --reload --locked lid:off output eDP-1 enable
bindswitch --reload --locked lid:off output eDP-1 enable '';
''; };
}; programs.waybar = {
programs.waybar = { enable = true;
enable = true; style = ''
style = '' * {
* { font-family: "Comic Code";
font-family: "Comic Code"; font-size: 20px;
font-size: 20px; }
} '';
''; settings = [{
settings = [{ modules-left = [ "sway/workspaces" "sway/mode" ];
modules-left = [ "sway/workspaces" "sway/mode" ]; modules-center = [ "sway/window" ];
modules-center = [ "sway/window" ]; modules-right = [ "pulseaudio" "battery" "clock" "tray" ];
modules-right = [ "pulseaudio" "battery" "clock" "tray" ]; }];
}]; };
};
} }

View file

@ -4,20 +4,20 @@
programs.vscode = { programs.vscode = {
enable = true; enable = true;
extensions = with pkgs; [ extensions = with pkgs; [
vscode-extensions.bbenoist.nix vscode-extensions.bbenoist.nix
vscode-extensions.tiehuis.zig vscode-extensions.tiehuis.zig
vscode-extensions.golang.go vscode-extensions.golang.go
]; ];
userSettings = { userSettings = {
"window.zoomLevel" = -1; "window.zoomLevel" = -1;
"editor.fontSize" = 24; "editor.fontSize" = 24;
"editor.fontFamily" = "'Comic Code'"; "editor.fontFamily" = "'Comic Code'";
"terminal.integrated.fontSize" = 24; "terminal.integrated.fontSize" = 24;
"editor.codeLensFontFamily" = "'Comic Code'"; "editor.codeLensFontFamily" = "'Comic Code'";
"editor.inlayHints.fontFamily" = "'Comic Code'"; "editor.inlayHints.fontFamily" = "'Comic Code'";
"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";
}; };
}; };
} }

View file

@ -1,4 +1,5 @@
{ home-manager, nixpkgs, tree, ... }@inputs: let { home-manager, nixpkgs, tree, ... }@inputs:
let
defaultModules = [ defaultModules = [
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
tree.impure.profiles.base tree.impure.profiles.base
@ -8,7 +9,8 @@
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";

View file

@ -1,4 +1,5 @@
{ nixpkgs, home-manager, ... }@inputs: let { nixpkgs, home-manager, ... }@inputs:
let
mkTree = import ./tree.nix { inherit (nixpkgs) lib; }; mkTree = import ./tree.nix { inherit (nixpkgs) lib; };
tree = mkTree { tree = mkTree {
inherit inputs; inherit inputs;
@ -9,7 +10,8 @@
"home/*".functor.enable = true; "home/*".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,5 +1,5 @@
{ 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=";

View file

@ -4,7 +4,7 @@
"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" ];
}; };

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { { pkgs, ... }: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
git git
nano nano
@ -6,5 +6,9 @@
wget wget
jq jq
ripgrep ripgrep
fd
htop
dig
nixpkgs-fmt
]; ];
} }

View file

@ -32,4 +32,4 @@
]; ];
}; };
}; };
} }

View file

@ -3,7 +3,7 @@
networkmanager = { networkmanager = {
enable = true; enable = true;
connectionConfig = { connectionConfig = {
"ipv6.ip6-privacy" = lib.mkForce 0; "ipv6.ip6-privacy" = lib.mkForce 0;
}; };
}; };
}; };

152
tree.nix
View file

@ -1,28 +1,36 @@
{ 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 }: let pureTreeGrab = { base, path }:
realPath = toString path; let
dirContents = builtins.readDir path; realPath = toString path;
isDirectory = entry: dirContents."${entry}" == "directory"; dirContents = builtins.readDir path;
isHidden = entry: hasPrefix "." entry; isDirectory = entry: dirContents."${entry}" == "directory";
isDir = entry: _: (isDirectory entry) && !(isHidden entry); isHidden = entry: hasPrefix "." entry;
directories = filterAttrs isDir dirContents; isDir = entry: _: (isDirectory entry) && !(isHidden entry);
isNixFile = entry: _: let directories = filterAttrs isDir dirContents;
result = builtins.match "(.*)\\.nix" entry; isNixFile = entry: _:
in result != null && builtins.length result > 0; let
nixFiles = filterAttrs isNixFile dirContents; result = builtins.match "(.*)\\.nix" entry;
getPath = entry: "${realPath}/${entry}"; in
getPaths = entries: mapAttrs' (n: v: result != null && builtins.length result > 0;
nameValuePair (removeSuffix ".nix" n) (getPath n) nixFiles = filterAttrs isNixFile dirContents;
) entries; getPath = entry: "${realPath}/${entry}";
nixFilePaths = getPaths nixFiles; getPaths = entries: mapAttrs'
dirPaths = getPaths directories; (n: v:
recursedPaths = mapAttrs (_: fullPath: pureTreeGrab { nameValuePair (removeSuffix ".nix" n) (getPath n)
inherit base; )
path = fullPath; entries;
}) dirPaths; nixFilePaths = getPaths nixFiles;
contents = recursedPaths // nixFilePaths; dirPaths = getPaths directories;
in contents; recursedPaths = mapAttrs
(_: fullPath: pureTreeGrab {
inherit base;
path = fullPath;
})
dirPaths;
contents = recursedPaths // nixFilePaths;
in
contents;
configTreeStruct = { config, ... }: { configTreeStruct = { config, ... }: {
options.treeConfig = mkOption { options.treeConfig = mkOption {
type = with types; attrsOf (submodule ({ name, options, config, ... }: { type = with types; attrsOf (submodule ({ name, options, config, ... }: {
@ -40,7 +48,7 @@
excludes = mkOption { excludes = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
description = "Exclude files or folders from the recurser."; description = "Exclude files or folders from the recurser.";
default = []; default = [ ];
}; };
functor = { functor = {
enable = mkOption { enable = mkOption {
@ -51,19 +59,19 @@
external = mkOption { external = mkOption {
type = types.listOf types.unspecified; type = types.listOf types.unspecified;
description = "Add external imports into the functor."; description = "Add external imports into the functor.";
default = []; default = [ ];
}; };
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 functor.";
default = []; default = [ ];
}; };
}; };
}; };
})); }));
}; };
config.treeConfig = { config.treeConfig = {
"*" = {}; "*" = { };
}; };
}; };
configTree.treeConfig = config; configTree.treeConfig = config;
@ -73,49 +81,63 @@
configTree configTree
]; ];
}).config.treeConfig; }).config.treeConfig;
mapAttrsRecursive = f: set: let mapAttrsRecursive = f: set:
recurse = path: set: let let
g = name: value: if isAttrs value recurse = path: set:
then f (path ++ [name]) (recurse (path ++ [name]) value) let
else f (path ++ [name]) value; g = name: value:
in mapAttrs g set; if isAttrs value
in recurse [] set; then f (path ++ [ name ]) (recurse (path ++ [ name ]) value)
else f (path ++ [ name ]) value;
in
mapAttrs g set;
in
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: let getConfigRecursive = path:
parentPath = revtail path; let
in getConfig (path ++ singleton "*") (getConfigRecursive parentPath); parentPath = revtail path;
processLeaves = tree: config: mapAttrsRecursive (path: value: let in
pathString = getPathString path; getConfig (path ++ singleton "*") (getConfigRecursive parentPath);
leafConfig = getConfig path (getConfigRecursive (revtail path)); processLeaves = tree: config: mapAttrsRecursive
processConfig = path: value: let (path: value:
processFunctor = prev: prev // { let
__functor = self: { ... }: { pathString = getPathString path;
imports = attrValues (removeAttrs prev leafConfig.functor.excludes) ++ leafConfig.functor.external; leafConfig = getConfig path (getConfigRecursive (revtail path));
}; processConfig = path: value:
}; let
processAliasDefault = prev: prev.default; processFunctor = prev: prev // {
processDefault = prev: import prev.default (args // { __functor = self: { ... }: {
inherit lib; imports = attrValues (removeAttrs prev leafConfig.functor.excludes) ++ leafConfig.functor.external;
tree = { };
prev = removeAttrs prev (singleton "default"); };
pure = pureTree; processAliasDefault = prev: prev.default;
impure = impureTree; processDefault = prev: import prev.default (args // {
}; inherit lib;
}); tree = {
processExcludes = prev: removeAttrs prev leafConfig.excludes; prev = removeAttrs prev (singleton "default");
processes = optionals (isAttrs value) ( pure = pureTree;
optional (leafConfig.excludes != []) processExcludes impure = impureTree;
++ optional leafConfig.evaluateDefault processDefault };
++ optional leafConfig.aliasDefault processAliasDefault });
++ optional leafConfig.functor.enable processFunctor processExcludes = prev: removeAttrs prev leafConfig.excludes;
); processes = optionals (isAttrs value) (
in pipe value processes; optional (leafConfig.excludes != [ ]) processExcludes
in processConfig path value) tree; ++ 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; }; 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;