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

@ -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

@ -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
@ -31,11 +44,13 @@
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";
@ -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,14 +133,14 @@
"${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
(workspace: {
"${cfg.modifier}+${workspace}" = "workspace ${workspace}"; "${cfg.modifier}+${workspace}" = "workspace ${workspace}";
"${cfg.modifier}+Shift+${workspace}" = "move container to workspace ${workspace}"; "${cfg.modifier}+Shift+${workspace}" = "move container to workspace ${workspace}";
}) [ "1" "2" "3" "4" "5" "6" "7" "8" "9" ])); }) [ "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
''; '';

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

@ -6,5 +6,9 @@
wget wget
jq jq
ripgrep ripgrep
fd
htop
dig
nixpkgs-fmt
]; ];
} }

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 }:
let
realPath = toString path; realPath = toString path;
dirContents = builtins.readDir path; dirContents = builtins.readDir path;
isDirectory = entry: dirContents."${entry}" == "directory"; isDirectory = entry: dirContents."${entry}" == "directory";
isHidden = entry: hasPrefix "." entry; isHidden = entry: hasPrefix "." entry;
isDir = entry: _: (isDirectory entry) && !(isHidden entry); isDir = entry: _: (isDirectory entry) && !(isHidden entry);
directories = filterAttrs isDir dirContents; directories = filterAttrs isDir dirContents;
isNixFile = entry: _: let isNixFile = entry: _:
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' (n: v: getPaths = entries: 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 (_: fullPath: pureTreeGrab { recursedPaths = mapAttrs
(_: fullPath: pureTreeGrab {
inherit base; inherit base;
path = fullPath; path = fullPath;
}) dirPaths; })
dirPaths;
contents = recursedPaths // nixFilePaths; contents = recursedPaths // nixFilePaths;
in contents; 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,23 +81,33 @@
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:
let
parentPath = revtail path; parentPath = revtail path;
in getConfig (path ++ singleton "*") (getConfigRecursive parentPath); in
processLeaves = tree: config: mapAttrsRecursive (path: value: let getConfig (path ++ singleton "*") (getConfigRecursive parentPath);
processLeaves = tree: config: mapAttrsRecursive
(path: value:
let
pathString = getPathString path; pathString = getPathString path;
leafConfig = getConfig path (getConfigRecursive (revtail path)); leafConfig = getConfig path (getConfigRecursive (revtail path));
processConfig = path: value: let processConfig = path: value:
let
processFunctor = prev: prev // { processFunctor = prev: prev // {
__functor = self: { ... }: { __functor = self: { ... }: {
imports = attrValues (removeAttrs prev leafConfig.functor.excludes) ++ leafConfig.functor.external; imports = attrValues (removeAttrs prev leafConfig.functor.excludes) ++ leafConfig.functor.external;
@ -106,16 +124,20 @@
}); });
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;
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;