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;
};
};
}
}

View file

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

View file

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

View file

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

View file

@ -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";
};
};
}
}

View file

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

View file

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

View file

@ -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=";

View file

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

View file

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

View file

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

View file

@ -3,7 +3,7 @@
networkmanager = {
enable = true;
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
# 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;