diff --git a/common/fonts.nix b/common/fonts.nix index 46a2d4be..122a3f3b 100644 --- a/common/fonts.nix +++ b/common/fonts.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { fonts = { fonts = with pkgs; [ font-awesome diff --git a/common/network.nix b/common/network.nix index 6f15b2d1..68b698f4 100644 --- a/common/network.nix +++ b/common/network.nix @@ -1,3 +1,3 @@ -{ machine, ... }: { +{machine, ...}: { networking.hostName = machine; } diff --git a/common/nix.nix b/common/nix.nix index 988e296c..b0c35948 100644 --- a/common/nix.nix +++ b/common/nix.nix @@ -5,7 +5,7 @@ inputs, ... }: let - inherit (std) set tuple list function; + inherit (std) set list; inherit (lib.strings) versionAtLeast; inputs' = set.filter (n: _: !list.elem n ["pypi-deps-db"]) (set.rename "self" "kat" inputs); in { diff --git a/darwin/common/overlay.nix b/darwin/common/overlay.nix index 69284a16..9bb8946a 100644 --- a/darwin/common/overlay.nix +++ b/darwin/common/overlay.nix @@ -1,7 +1,5 @@ { inputs, - pkgs, - tree, system, ... }: { diff --git a/darwin/distributed.nix b/darwin/distributed.nix index 73a306eb..9ee7caee 100644 --- a/darwin/distributed.nix +++ b/darwin/distributed.nix @@ -1,11 +1,12 @@ -{ pkgs, ... }: { +{pkgs, ...}: { nix.envVars = { "SSH_AUTH_SOCK" = "/Users/kat/.gnupg/S.gpg-agent.ssh"; }; launchd.daemons.start_nixos_native = { serviceConfig.ProgramArguments = [ - "/bin/sh" "-c" + "/bin/sh" + "-c" "/bin/wait4path /nix/store && ${pkgs.writeScript "start_nixos_native" '' /usr/bin/open "utm://start?name=NixOS Native" ''}" diff --git a/kat/base16.nix b/kat/base16.nix index 5bd16e77..3c1b9213 100644 --- a/kat/base16.nix +++ b/kat/base16.nix @@ -1,7 +1,4 @@ -{ - lib, - ... -}: let +{lib, ...}: let inherit (lib.modules) mkMerge; in { base16 = { diff --git a/kat/default.nix b/kat/default.nix index bb06d85b..7a7edd8c 100644 --- a/kat/default.nix +++ b/kat/default.nix @@ -16,7 +16,7 @@ in dirImports // { - user = tree.prev.user; + inherit (tree.prev) user; common = { imports = with tree.prev; [ base16 diff --git a/kat/gnome/dconf.nix b/kat/gnome/dconf.nix index b3480fa3..d4230fff 100644 --- a/kat/gnome/dconf.nix +++ b/kat/gnome/dconf.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +_: { dconf = { enable = true; settings = { diff --git a/kat/gui/media.nix b/kat/gui/media.nix index e8b63776..da421ebc 100644 --- a/kat/gui/media.nix +++ b/kat/gui/media.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { home.packages = with pkgs; [ imv # Image viewer yt-dlp # Downloading media diff --git a/kat/gui/mpv.nix b/kat/gui/mpv.nix index 7d4d65b9..d433f160 100644 --- a/kat/gui/mpv.nix +++ b/kat/gui/mpv.nix @@ -1,119 +1,125 @@ -{ config, lib, pkgs, ... }: let +{ + config, + lib, + pkgs, + ... +}: let inherit (lib.modules) mkMerge mkIf; inherit (lib.attrsets) mapAttrsToList; in { # TODO: fix lib usage programs.mpv = { enable = true; - scripts = with pkgs.mpvScripts; [ sponsorblock paused ]; - bindings = - let - vim = { - "l" = "seek 5"; - "h" = "seek -5"; - "k" = "seek 60"; - "j" = "seek -60"; - "Ctrl+l" = "seek 1 exact"; - "Ctrl+h" = "seek -1 exact"; - "Ctrl+L" = "sub-seek 1"; - "Ctrl+H" = "sub-seek -1"; - "Ctrl+k" = "add chapter 1"; - "Ctrl+j" = "add chapter -1"; - "Ctrl+K" = "playlist-next"; - "Ctrl+J" = "playlist-prev"; - "Alt+h" = "frame-back-step"; - "Alt+l" = "frame-step"; - "`" = "cycle mute"; - "MBTN_RIGHT" = "cycle pause"; - "w" = "screenshot"; - "W" = "screenshot video"; - "Ctrl+w" = "screenshot window"; - "Ctrl+W" = "screenshot each-frame"; - "o" = "show-progress"; - "O" = "script-message show_osc_dur 5"; - "F1" = "cycle sub"; - "F2" = "cycle audio"; - "Ctrl+p" = "cycle video"; - "L" = "add volume 2"; - "H" = "add volume -2"; - "Alt+H" = "add audio-delay -0.100"; - "Alt+L" = "add audio-delay 0.100"; - "1" = "set volume 10"; - "2" = "set volume 20"; - "3" = "set volume 30"; - "4" = "set volume 40"; - "5" = "set volume 50"; - "6" = "set volume 60"; - "7" = "set volume 70"; - "8" = "set volume 80"; - "9" = "set volume 90"; - ")" = "set volume 150"; - "0" = "set volume 100"; - "m" = "cycle mute"; - "Ctrl+r" = "loadfile \${path}"; - "Ctrl+R" = "video-reload"; - "d" = "drop-buffers"; - "Ctrl+d" = "quit"; - }; - other = { - "RIGHT" = vim."l"; - "LEFT" = vim."h"; - "UP" = vim."k"; - "DOWN" = vim."j"; - "Ctrl+0" = "set speed 1.0"; - "Ctrl+=" = "multiply speed 1.1"; - "Ctrl+-" = "multiply speed 1/1.1"; - "Shift+LEFT" = vim."H"; - "Shift+RIGHT" = vim."L"; - "Ctrl+RIGHT" = vim."Ctrl+l"; - "Ctrl+LEFT" = vim."Ctrl+h"; - "Ctrl+Shift+LEFT" = vim."Ctrl+H"; - "Ctrl+Shift+RIGHT" = vim."Ctrl+L"; - "Ctrl+UP" = vim."Ctrl+k"; - "Ctrl+DOWN" = vim."Ctrl+j"; - "Ctrl+Shift+UP" = vim."Ctrl+K"; - "Ctrl+Shift+DOWN" = vim."Ctrl+J"; - "Alt+LEFT" = vim."Alt+h"; - "Alt+RIGHT" = vim."Alt+l"; - "SPACE" = vim."MBTN_RIGHT"; - "m" = vim."`"; - "WHEEL_UP" = vim."L"; - "WHEEL_DOWN" = vim."H"; - }; - in + scripts = with pkgs.mpvScripts; [sponsorblock paused]; + bindings = let + vim = { + "l" = "seek 5"; + "h" = "seek -5"; + "k" = "seek 60"; + "j" = "seek -60"; + "Ctrl+l" = "seek 1 exact"; + "Ctrl+h" = "seek -1 exact"; + "Ctrl+L" = "sub-seek 1"; + "Ctrl+H" = "sub-seek -1"; + "Ctrl+k" = "add chapter 1"; + "Ctrl+j" = "add chapter -1"; + "Ctrl+K" = "playlist-next"; + "Ctrl+J" = "playlist-prev"; + "Alt+h" = "frame-back-step"; + "Alt+l" = "frame-step"; + "`" = "cycle mute"; + "MBTN_RIGHT" = "cycle pause"; + "w" = "screenshot"; + "W" = "screenshot video"; + "Ctrl+w" = "screenshot window"; + "Ctrl+W" = "screenshot each-frame"; + "o" = "show-progress"; + "O" = "script-message show_osc_dur 5"; + "F1" = "cycle sub"; + "F2" = "cycle audio"; + "Ctrl+p" = "cycle video"; + "L" = "add volume 2"; + "H" = "add volume -2"; + "Alt+H" = "add audio-delay -0.100"; + "Alt+L" = "add audio-delay 0.100"; + "1" = "set volume 10"; + "2" = "set volume 20"; + "3" = "set volume 30"; + "4" = "set volume 40"; + "5" = "set volume 50"; + "6" = "set volume 60"; + "7" = "set volume 70"; + "8" = "set volume 80"; + "9" = "set volume 90"; + ")" = "set volume 150"; + "0" = "set volume 100"; + "m" = "cycle mute"; + "Ctrl+r" = "loadfile \${path}"; + "Ctrl+R" = "video-reload"; + "d" = "drop-buffers"; + "Ctrl+d" = "quit"; + }; + other = { + "RIGHT" = vim."l"; + "LEFT" = vim."h"; + "UP" = vim."k"; + "DOWN" = vim."j"; + "Ctrl+0" = "set speed 1.0"; + "Ctrl+=" = "multiply speed 1.1"; + "Ctrl+-" = "multiply speed 1/1.1"; + "Shift+LEFT" = vim."H"; + "Shift+RIGHT" = vim."L"; + "Ctrl+RIGHT" = vim."Ctrl+l"; + "Ctrl+LEFT" = vim."Ctrl+h"; + "Ctrl+Shift+LEFT" = vim."Ctrl+H"; + "Ctrl+Shift+RIGHT" = vim."Ctrl+L"; + "Ctrl+UP" = vim."Ctrl+k"; + "Ctrl+DOWN" = vim."Ctrl+j"; + "Ctrl+Shift+UP" = vim."Ctrl+K"; + "Ctrl+Shift+DOWN" = vim."Ctrl+J"; + "Alt+LEFT" = vim."Alt+h"; + "Alt+RIGHT" = vim."Alt+l"; + "SPACE" = vim."MBTN_RIGHT"; + "m" = vim."`"; + "WHEEL_UP" = vim."L"; + "WHEEL_DOWN" = vim."H"; + }; + in vim // other; - config = mkMerge [ - (mkIf config.wayland.windowManager.sway.enable { - gpu-context = "wayland"; - }) - { - no-input-default-bindings = ""; - profile = "gpu-hq"; - hwdec = "auto"; - vo = "gpu"; - volume-max = 200; - keep-open = true; - opengl-waitvsync = true; - demuxer-max-bytes = "2000MiB"; - demuxer-max-back-bytes = "250MiB"; - osd-scale-by-window = false; - osd-bar-h = 2.5; # 3.125 default - osd-border-size = 2; # font border pixels, default 3 - term-osd-bar = true; - script-opts = builtins.concatStringsSep "," - (mapAttrsToList (k: v: "${k}=${toString v}") { - ytdl_hook-ytdl_path = "${pkgs.yt-dlp}/bin/yt-dlp"; - osc-layout = "slimbox"; - osc-vidscale = "no"; - osc-deadzonesize = 0.75; - osc-minmousemove = 4; - osc-hidetimeout = 2000; - osc-valign = 0.9; - osc-timems = "yes"; - osc-seekbarstyle = "knob"; - osc-seekbarkeyframes = "no"; - osc-seekrangestyle = "slider"; - }); - }]; + config = mkMerge [ + (mkIf config.wayland.windowManager.sway.enable { + gpu-context = "wayland"; + }) + { + no-input-default-bindings = ""; + profile = "gpu-hq"; + hwdec = "auto"; + vo = "gpu"; + volume-max = 200; + keep-open = true; + opengl-waitvsync = true; + demuxer-max-bytes = "2000MiB"; + demuxer-max-back-bytes = "250MiB"; + osd-scale-by-window = false; + osd-bar-h = 2.5; # 3.125 default + osd-border-size = 2; # font border pixels, default 3 + term-osd-bar = true; + script-opts = + builtins.concatStringsSep "," + (mapAttrsToList (k: v: "${k}=${toString v}") { + ytdl_hook-ytdl_path = "${pkgs.yt-dlp}/bin/yt-dlp"; + osc-layout = "slimbox"; + osc-vidscale = "no"; + osc-deadzonesize = 0.75; + osc-minmousemove = 4; + osc-hidetimeout = 2000; + osc-valign = 0.9; + osc-timems = "yes"; + osc-seekbarstyle = "knob"; + osc-seekbarkeyframes = "no"; + osc-seekrangestyle = "slider"; + }); + } + ]; }; } diff --git a/kat/sway/gtk.nix b/kat/sway/gtk.nix index a1378615..b4d01a37 100644 --- a/kat/sway/gtk.nix +++ b/kat/sway/gtk.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { home.packages = with pkgs; [ gnome.adwaita-icon-theme ]; diff --git a/kat/sway/konashow.nix b/kat/sway/konashow.nix index 81f70ab7..4f896f97 100644 --- a/kat/sway/konashow.nix +++ b/kat/sway/konashow.nix @@ -1,4 +1,8 @@ -{ config, lib, ... }: { +{ + config, + lib, + ... +}: { # TODO: fix lib use home.packages = [ config.services.konawall.konashow @@ -8,7 +12,7 @@ enable = true; interval = "30m"; mode = "shuffle"; - commonTags = [ "width:>=1600" ]; + commonTags = ["width:>=1600"]; tagList = map lib.toList [ [ "score:>=50" diff --git a/kat/sway/mako.nix b/kat/sway/mako.nix index deeb3044..1bd42110 100644 --- a/kat/sway/mako.nix +++ b/kat/sway/mako.nix @@ -1,18 +1,21 @@ -{ config, pkgs, ... }: let +{ + config, + pkgs, + ... +}: let inherit (config.base16) palette; in { systemd.user.services = { mako = { Unit = { Description = "mako"; - X-Restart-Triggers = - [ (toString config.xdg.configFile."mako/config".source) ]; + X-Restart-Triggers = [(toString config.xdg.configFile."mako/config".source)]; }; Service = { ExecStart = "${pkgs.mako}/bin/mako"; Restart = "always"; }; - Install = { WantedBy = [ "graphical-session.target" ]; }; + Install = {WantedBy = ["graphical-session.target"];}; }; }; diff --git a/kat/sway/wofi.nix b/kat/sway/wofi.nix index 3b3fffe5..8d408389 100644 --- a/kat/sway/wofi.nix +++ b/kat/sway/wofi.nix @@ -1,10 +1,14 @@ -{ kittywitch, ... }: { +{kittywitch, ...}: { programs.wofi = { enable = true; settings = { style = let - template = kittywitch.sassTemplate { name = "wofi-style"; src = ./wofi.sass; }; - in template.source; + template = kittywitch.sassTemplate { + name = "wofi-style"; + src = ./wofi.sass; + }; + in + template.source; insensitive = true; allow_images = true; hide_scroll = true; diff --git a/modules/home/base16.nix b/modules/home/base16.nix index bb8c2fcf..b541ebdb 100644 --- a/modules/home/base16.nix +++ b/modules/home/base16.nix @@ -1,59 +1,74 @@ -{ config, pkgs, lib, ... }: let +{ + config, + pkgs, + lib, + ... +}: let inherit (lib.types) attrsOf str enum; inherit (lib.modules) mkIf; cfg = config.base16; -in with lib; { - options.base16 = { - palette = mkOption { - type = attrsOf str; - }; - sass = { - variables = mkOption { +in + with lib; { + options.base16 = { + palette = mkOption { type = attrsOf str; - default = cfg.palette // { - term_font = "Iosevka"; - font = "Iosevka"; - font_size = "12px"; + }; + sass = { + variables = mkOption { + type = attrsOf str; + default = + cfg.palette + // { + term_font = "Iosevka"; + font = "Iosevka"; + font_size = "12px"; + }; + }; + css_style = mkOption { + type = enum ["nested" "compressed" "compact" "expanded"]; + default = "expanded"; }; }; - css_style = mkOption { - type = enum [ "nested" "compressed" "compact" "expanded" ]; - default = "expanded"; + }; + config = mkIf (cfg.schemes != {}) { + base16 = { + # TODO: convert to std + palette = + lib.mapAttrs' (k: v: + lib.nameValuePair + k + "#${v.hex}") + (lib.filterAttrs (n: _: lib.hasInfix "base" n) + cfg.defaultScheme); }; - }; - }; - config = mkIf (cfg.schemes != {}) { - base16 = { - # TODO: convert to std - palette = lib.mapAttrs' (k: v: - lib.nameValuePair - k - "#${v.hex}") - (lib.filterAttrs (n: _: lib.hasInfix "base" n) - cfg.defaultScheme); - }; - lib.kittywitch.sassTemplate = { name, src }: - let + lib.kittywitch.sassTemplate = { + name, + src, + }: let variables = pkgs.writeText "base-variables.sass" '' - ${(concatStringsSep "\n" (mapAttrsToList(var: con: "\$${var}: ${con}") cfg.sass.variables))} + ${(concatStringsSep "\n" (mapAttrsToList (var: con: "\$${var}: ${con}") cfg.sass.variables))} ''; - source = pkgs.callPackage - ({ sass, stdenv }: stdenv.mkDerivation { - inherit name src variables; - nativeBuildInputs = lib.singleton pkgs.sass; - phases = [ "buildPhase" ]; - buildPhase = '' - cat $variables $src > src-mut.sass - sass src-mut.sass $out --sourcemap=none --trace --style=${cfg.sass.css_style} - ''; - }) - { }; - in - { + source = + pkgs.callPackage + ({ + sass, + stdenv, + }: + stdenv.mkDerivation { + inherit name src variables; + nativeBuildInputs = lib.singleton pkgs.sass; + phases = ["buildPhase"]; + buildPhase = '' + cat $variables $src > src-mut.sass + sass src-mut.sass $out --sourcemap=none --trace --style=${cfg.sass.css_style} + ''; + }) + {}; + in { inherit source; text = builtins.readFile source; }; - _module.args = { inherit (config.lib) kittywitch; }; - }; -} + _module.args = {inherit (config.lib) kittywitch;}; + }; + } diff --git a/modules/home/waybar.nix b/modules/home/waybar.nix index d1dc6613..8740942d 100644 --- a/modules/home/waybar.nix +++ b/modules/home/waybar.nix @@ -1,7 +1,12 @@ -{ config, lib, ... }: let +{ + config, + lib, + ... +}: let inherit (lib.modules) mkIf; -in mkIf (config.programs.waybar.enable) { - systemd.user.services.waybar.Unit.X-Restart-Triggers = [ - (builtins.toString config.programs.waybar.style) - ]; -} +in + mkIf config.programs.waybar.enable { + systemd.user.services.waybar.Unit.X-Restart-Triggers = [ + (builtins.toString config.programs.waybar.style) + ]; + } diff --git a/modules/nixos/scalpels.nix b/modules/nixos/scalpels.nix index 7c1ca13d..f159d78d 100644 --- a/modules/nixos/scalpels.nix +++ b/modules/nixos/scalpels.nix @@ -1,8 +1,4 @@ -{ - config, - lib, - ... -}: let +{lib, ...}: let inherit (lib.types) listOf path; inherit (lib.options) mkOption; in { diff --git a/nixos/arc.nix b/nixos/arc.nix index 861f4fb1..80c939cd 100644 --- a/nixos/arc.nix +++ b/nixos/arc.nix @@ -1,13 +1,11 @@ -({ config, pkgs, ... }: - - { - users.users.arc = { - uid = 1001; - isNormalUser = true; - extraGroups = [ "wheel" ]; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ8Z6briIboxIdedPGObEWB6QEQkvxKvnMW/UVU9t/ac mew-pgp" - ]; - shell = pkgs.zsh; - }; - }) +({pkgs, ...}: { + users.users.arc = { + uid = 1001; + isNormalUser = true; + extraGroups = ["wheel"]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ8Z6briIboxIdedPGObEWB6QEQkvxKvnMW/UVU9t/ac mew-pgp" + ]; + shell = pkgs.zsh; + }; +}) diff --git a/nixos/common/access.nix b/nixos/common/access.nix index cd5296f7..6acce36d 100644 --- a/nixos/common/access.nix +++ b/nixos/common/access.nix @@ -1,31 +1,40 @@ -{ config, pkgs, lib, ... }: let -# TODO: solve lib usage -inherit (lib.lists) concatLists elem; -inherit (lib.attrsets) mapAttrsToList; -commonUser = { - openssh.authorizedKeys.keys = concatLists (mapAttrsToList - (_: user: - if elem "wheel" user.extraGroups then - user.openssh.authorizedKeys.keys - else - [ ]) - config.users.users); -}; +{ + config, + lib, + ... +}: let + # TODO: solve lib usage + inherit (lib.lists) concatLists elem; + inherit (lib.attrsets) mapAttrsToList; + commonUser = { + openssh.authorizedKeys.keys = concatLists (mapAttrsToList + (_: user: + if elem "wheel" user.extraGroups + then user.openssh.authorizedKeys.keys + else []) + config.users.users); + }; in { - security.sudo.extraRules = [{ - users = [ "deploy" ]; - commands = [ { - command = "ALL"; - options = [ - "NOPASSWD" - "SETENV" + security.sudo.extraRules = [ + { + users = ["deploy"]; + commands = [ + { + command = "ALL"; + options = [ + "NOPASSWD" + "SETENV" + ]; + } ]; - } ]; - }]; + } + ]; users.users = { root = commonUser; - deploy = commonUser // { - isNormalUser = true; - }; + deploy = + commonUser + // { + isNormalUser = true; + }; }; } diff --git a/nixos/common/autoupgrade.nix b/nixos/common/autoupgrade.nix index 0e39b3bb..2a940196 100644 --- a/nixos/common/autoupgrade.nix +++ b/nixos/common/autoupgrade.nix @@ -1,6 +1,6 @@ -{ config, ... }: { +{config, ...}: { system.autoUpgrade = { enable = true; flake = "github:kittywitch/kittywitch#${config.networking.hostName}"; }; -} \ No newline at end of file +} diff --git a/nixos/common/base16.nix b/nixos/common/base16.nix index b1bfaec3..77baab66 100644 --- a/nixos/common/base16.nix +++ b/nixos/common/base16.nix @@ -1,4 +1,4 @@ -{ config, ... }: { +{config, ...}: { base16 = { inherit (config.home-manager.users.kat.base16) defaultSchemeName defaultScheme schemes; console = { diff --git a/nixos/common/locale.nix b/nixos/common/locale.nix index 5b168a7b..b556feb7 100644 --- a/nixos/common/locale.nix +++ b/nixos/common/locale.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { fonts.fonts = [ pkgs.tamzen ]; @@ -12,7 +12,7 @@ ]; }; console = { - packages = [ pkgs.tamzen ]; + packages = [pkgs.tamzen]; font = "Tamzen7x14"; earlySetup = true; keyMap = "uk"; diff --git a/nixos/common/secrets.nix b/nixos/common/secrets.nix index 7479e87f..e8d8f73f 100644 --- a/nixos/common/secrets.nix +++ b/nixos/common/secrets.nix @@ -1,6 +1,6 @@ _: { - users.groups.secrets = {}; - systemd.tmpfiles.rules = [ - "v /var/lib/secrets 700 deploy secrets" - ]; -} \ No newline at end of file + users.groups.secrets = {}; + systemd.tmpfiles.rules = [ + "v /var/lib/secrets 700 deploy secrets" + ]; +} diff --git a/nixos/common/ssh.nix b/nixos/common/ssh.nix index 3b70c173..05c727fb 100644 --- a/nixos/common/ssh.nix +++ b/nixos/common/ssh.nix @@ -1,19 +1,31 @@ -{ config, lib, std, ... }: let +{ + config, + lib, + std, + ... +}: let inherit (lib.modules) mkDefault; inherit (std) list; in { networking.firewall = { - allowedTCPPorts = [ (list.unsafeHead config.services.openssh.ports) ]; - allowedUDPPortRanges = [ { from = 60000; to = 61000; } ]; + allowedTCPPorts = [(list.unsafeHead config.services.openssh.ports)]; + allowedUDPPortRanges = [ + { + from = 60000; + to = 61000; + } + ]; }; services.openssh = { enable = true; -/* knownHosts.katca = { + /* + knownHosts.katca = { certAuthority = true; publicKey = builtins.readFile ./ca-pubkey.pem; - }; */ - kexAlgorithms = [ "curve25519-sha256@libssh.org" ]; + }; + */ + kexAlgorithms = ["curve25519-sha256@libssh.org"]; settings = { PasswordAuthentication = false; KbdInteractiveAuthentication = false; diff --git a/nixos/common/time.nix b/nixos/common/time.nix index 024d0f83..93cb4857 100644 --- a/nixos/common/time.nix +++ b/nixos/common/time.nix @@ -2,11 +2,11 @@ _: { services.tzupdate.enable = true; systemd.timers."tzupdate" = { - wantedBy = [ "timers.target" ]; - timerConfig = { - OnBootSec = "5m"; - OnUnitActiveSec = "5m"; - Unit = "tzupdate.service"; - }; + wantedBy = ["timers.target"]; + timerConfig = { + OnBootSec = "5m"; + OnUnitActiveSec = "5m"; + Unit = "tzupdate.service"; + }; }; } diff --git a/nixos/hardware/bluetooth.nix b/nixos/hardware/bluetooth.nix index 38a29980..8f1096ff 100644 --- a/nixos/hardware/bluetooth.nix +++ b/nixos/hardware/bluetooth.nix @@ -1,5 +1,5 @@ -{ pkgs, ... }: { - environment.systemPackages = with pkgs; [ bluez5-experimental ]; +{pkgs, ...}: { + environment.systemPackages = with pkgs; [bluez5-experimental]; environment.etc = { "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' diff --git a/nixos/hardware/default.nix b/nixos/hardware/default.nix index c9f27b4f..533925c3 100644 --- a/nixos/hardware/default.nix +++ b/nixos/hardware/default.nix @@ -1,4 +1,9 @@ -{ lib, tree, ... }: with lib; let +{ + lib, + tree, + ... +}: +with lib; let profiles = tree.prev; appendedProfiles = { common-wifi-bt = { @@ -23,4 +28,4 @@ }; }; in -profiles // appendedProfiles + profiles // appendedProfiles diff --git a/nixos/hardware/laptop.nix b/nixos/hardware/laptop.nix index 4124e069..01c6c799 100644 --- a/nixos/hardware/laptop.nix +++ b/nixos/hardware/laptop.nix @@ -1,33 +1,37 @@ -{lib, pkgs, ...}: let -inherit (lib.modules) mkDefault mkOrder; +{ + lib, + pkgs, + ... +}: let + inherit (lib.modules) mkDefault; in { powerManagement.cpuFreqGovernor = mkDefault "powersave"; programs.light.enable = true; home-manager.sharedModules = [ - { - programs.waybar.settings.main = { - modules-right = [ - "backlight" - "battery" - ]; - backlight = { - format = " {percent}%"; - on-scroll-up = "${pkgs.light}/bin/light -A 1"; - on-scroll-down = "${pkgs.light}/bin/light -U 1"; - }; - battery = { - states = { - good = 90; - warning = 30; - critical = 15; + { + programs.waybar.settings.main = { + modules-right = [ + "backlight" + "battery" + ]; + backlight = { + format = " {percent}%"; + on-scroll-up = "${pkgs.light}/bin/light -A 1"; + on-scroll-down = "${pkgs.light}/bin/light -U 1"; + }; + battery = { + states = { + good = 90; + warning = 30; + critical = 15; + }; + format = "{icon} {capacity}%"; + format-charging = " {capacity}%"; + format-plugged = " {capacity}%"; + format-alt = "{icon} {time}"; + format-icons = ["" "" "" "" ""]; }; - format = "{icon} {capacity}%"; - format-charging = " {capacity}%"; - format-plugged = " {capacity}%"; - format-alt = "{icon} {time}"; - format-icons = [ "" "" "" "" "" ]; }; - }; - } + } ]; } diff --git a/nixos/hardware/lenovo-thinkpad-x260-local.nix b/nixos/hardware/lenovo-thinkpad-x260-local.nix index 108fd560..451cb272 100644 --- a/nixos/hardware/lenovo-thinkpad-x260-local.nix +++ b/nixos/hardware/lenovo-thinkpad-x260-local.nix @@ -1,19 +1,17 @@ -{lib, ...}: let -in { +_: { boot = { - initrd.availableKernelModules = - [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "sr_mod" "rtsx_usb_sdmmc" ]; - kernelModules = [ "kvm-intel" ]; + initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod" "sr_mod" "rtsx_usb_sdmmc"]; + kernelModules = ["kvm-intel"]; }; home-manager.sharedModules = [ - { - wayland.windowManager.sway.config.input."2:7:SynPS/2_Synaptics_TouchPad" = { - dwt = "enabled"; - tap = "enabled"; - natural_scroll = "enabled"; - middle_emulation = "enabled"; - click_method = "clickfinger"; - }; - } + { + wayland.windowManager.sway.config.input."2:7:SynPS/2_Synaptics_TouchPad" = { + dwt = "enabled"; + tap = "enabled"; + natural_scroll = "enabled"; + middle_emulation = "enabled"; + click_method = "clickfinger"; + }; + } ]; } diff --git a/nixos/hardware/sound.nix b/nixos/hardware/sound.nix index 80dc8190..7d00c55f 100644 --- a/nixos/hardware/sound.nix +++ b/nixos/hardware/sound.nix @@ -1,13 +1,11 @@ -{lib, pkgs, ...}: let -inherit (lib.modules) mkDefault mkOrder; -in { - environment.systemPackages = with pkgs; [ pulsemixer ]; +{pkgs, ...}: { + environment.systemPackages = with pkgs; [pulsemixer]; sound = { enable = true; extraConfig = '' defaults.pcm.rate_converter "speexrate_best" - ''; + ''; }; hardware.pulseaudio.enable = false; @@ -22,26 +20,26 @@ in { }; home-manager.sharedModules = [ - { - programs.waybar.settings.main = { - modules-right = [ - "pulseaudio" - ]; - pulseaudio = { - format = "{icon} {volume}%"; - format-muted = ""; - on-click = "${pkgs.wezterm}/bin/wezterm start ${pkgs.pulsemixer}/bin/pulsemixer"; - format-icons = { - headphone = ""; - headset = ""; - default = [ - "" + { + programs.waybar.settings.main = { + modules-right = [ + "pulseaudio" + ]; + pulseaudio = { + format = "{icon} {volume}%"; + format-muted = ""; + on-click = "${pkgs.wezterm}/bin/wezterm start ${pkgs.pulsemixer}/bin/pulsemixer"; + format-icons = { + headphone = ""; + headset = ""; + default = [ + "" "" "" - ]; + ]; + }; }; }; - }; - } + } ]; } diff --git a/nixos/hardware/wifi.nix b/nixos/hardware/wifi.nix index 90ecc50a..aa20214a 100644 --- a/nixos/hardware/wifi.nix +++ b/nixos/hardware/wifi.nix @@ -1,13 +1,22 @@ -{ lib, pkgs, ... }: let -inherit (lib.modules) mkForce; +{ + lib, + pkgs, + ... +}: let + inherit (lib.modules) mkForce; in { systemd.services.NetworkManager-wait-online = { - serviceConfig.ExecStart = [ "" "${pkgs.networkmanager}/bin/nm-online -q" ]; + serviceConfig.ExecStart = ["" "${pkgs.networkmanager}/bin/nm-online -q"]; }; networking = { firewall = { - allowedUDPPorts = [ 5353 ]; # MDNS - allowedUDPPortRanges = [ { from = 32768; to=60999; } ]; # Ephemeral / Chromecast + allowedUDPPorts = [5353]; # MDNS + allowedUDPPortRanges = [ + { + from = 32768; + to = 60999; + } + ]; # Ephemeral / Chromecast }; networkmanager = { enable = true; diff --git a/nixos/roles/bootable.nix b/nixos/roles/bootable.nix index 318a2223..a8678a6f 100644 --- a/nixos/roles/bootable.nix +++ b/nixos/roles/bootable.nix @@ -1,4 +1,9 @@ -{ config, lib, std, ... }: let +{ + config, + lib, + std, + ... +}: let inherit (lib.modules) mkDefault mkIf mkMerge; inherit (std) list; in { diff --git a/nixos/roles/gnome/gnome.nix b/nixos/roles/gnome/gnome.nix index f4bb57b0..d94608f0 100644 --- a/nixos/roles/gnome/gnome.nix +++ b/nixos/roles/gnome/gnome.nix @@ -1,10 +1,4 @@ -{ - pkgs, - lib, - ... -}: let - inherit (lib.modules) mkForce; -in { +{pkgs, ...}: { services.xserver.enable = true; services.xserver.displayManager.gdm.enable = true; services.xserver.desktopManager.gnome.enable = true; diff --git a/nixos/roles/graphical/fonts.nix b/nixos/roles/graphical/fonts.nix index bb1e77b0..8e9439d2 100644 --- a/nixos/roles/graphical/fonts.nix +++ b/nixos/roles/graphical/fonts.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +_: { fonts = { enableDefaultFonts = true; fontDir.enable = true; diff --git a/nixos/roles/graphical/gpg.nix b/nixos/roles/graphical/gpg.nix index 7a62e5b4..1628af12 100644 --- a/nixos/roles/graphical/gpg.nix +++ b/nixos/roles/graphical/gpg.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: { +{pkgs, ...}: { services.pcscd.enable = true; - services.udev.packages = [ pkgs.yubikey-personalization ]; + services.udev.packages = [pkgs.yubikey-personalization]; programs.gnupg.agent = { enable = true; diff --git a/nixos/roles/graphical/nfs.nix b/nixos/roles/graphical/nfs.nix index 7c359a2c..64610cfe 100644 --- a/nixos/roles/graphical/nfs.nix +++ b/nixos/roles/graphical/nfs.nix @@ -1,3 +1,3 @@ _: { - boot.supportedFilesystems = [ "nfs" ]; + boot.supportedFilesystems = ["nfs"]; } diff --git a/nixos/roles/graphical/packages.nix b/nixos/roles/graphical/packages.nix index 650b2fff..bc6b2884 100644 --- a/nixos/roles/graphical/packages.nix +++ b/nixos/roles/graphical/packages.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { environment.systemPackages = with pkgs; [ android-udev-rules jmtpfs diff --git a/nixos/roles/matrix-server/scalpel.nix b/nixos/roles/matrix-server/scalpel.nix index 931b0ef5..cdd4b4c6 100644 --- a/nixos/roles/matrix-server/scalpel.nix +++ b/nixos/roles/matrix-server/scalpel.nix @@ -1,7 +1,6 @@ { lib, config, - pkgs, prev, ... }: let diff --git a/nixos/roles/sway/sway.nix b/nixos/roles/sway/sway.nix index ff7c45b7..1a304215 100644 --- a/nixos/roles/sway/sway.nix +++ b/nixos/roles/sway/sway.nix @@ -1,9 +1,15 @@ -{ config, pkgs, std, lib, ... }: let +{ + config, + pkgs, + std, + lib, + ... +}: let inherit (std) set list; inherit (lib.modules) mkForce; in { programs.sway = { enable = list.any (user: user.wayland.windowManager.sway.enable) (set.values config.home-manager.users); - extraPackages = with pkgs; mkForce [ xwayland swaylock swayidle swaylock-fancy wmctrl ]; + extraPackages = with pkgs; mkForce [xwayland swaylock swayidle swaylock-fancy wmctrl]; }; } diff --git a/nixos/roles/sway/xdg-portals.nix b/nixos/roles/sway/xdg-portals.nix index f429a157..20651ac9 100644 --- a/nixos/roles/sway/xdg-portals.nix +++ b/nixos/roles/sway/xdg-portals.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { xdg = { portal = { enable = true; diff --git a/nixos/roles/web-server/scalpel.nix b/nixos/roles/web-server/scalpel.nix index 8096cbb2..7d59d0ba 100644 --- a/nixos/roles/web-server/scalpel.nix +++ b/nixos/roles/web-server/scalpel.nix @@ -1,10 +1,4 @@ -{ - lib, - config, - pkgs, - prev, - ... -}: { +{config, ...}: { scalpel.trafos."credentials_file" = { source = "/etc/ssl/credentials_template"; matchers."CLOUDFLARE_EMAIL".secret = config.sops.secrets.cloudflare_email.path; diff --git a/nixos/rosetta.nix b/nixos/rosetta.nix index b26a3c84..6a368528 100644 --- a/nixos/rosetta.nix +++ b/nixos/rosetta.nix @@ -1,6 +1,6 @@ _: { boot = { - initrd.availableKernelModules = [ "virtiofs"]; + initrd.availableKernelModules = ["virtiofs"]; binfmt.registrations."rosetta" = { interpreter = "/run/rosetta/rosetta"; fixBinary = true; @@ -12,7 +12,7 @@ _: { }; nix.settings = { - extra-platforms = [ "x86_64-linux" ]; - extra-sandbox-paths = [ "/run/rosetta" "/run/binfmt" ]; + extra-platforms = ["x86_64-linux"]; + extra-sandbox-paths = ["/run/rosetta" "/run/binfmt"]; }; } diff --git a/outputs.nix b/outputs.nix index 05195ffc..e9be7a43 100644 --- a/outputs.nix +++ b/outputs.nix @@ -8,10 +8,10 @@ inherit (import ./pkgs.nix {inherit inputs tree overlay;}) pkgs; formatter = import ./formatter.nix {inherit inputs pkgs;}; inherit (std) set; - #checks = set.map (_: deployLib: deployLib.deployChecks inputs.self.deploy) inputs.deploy-rs.lib; + checks = set.map (_: deployLib: deployLib.deployChecks inputs.self.deploy) inputs.deploy-rs.lib; in { - inherit inputs tree std pkgs formatter lib; # checks + inherit inputs tree std pkgs formatter lib checks; legacyPackages = pkgs; } // systems diff --git a/packages/default.nix b/packages/default.nix index 635656ee..7894374b 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -1,3 +1,9 @@ -{ inputs, tree, ... }: final: prev: let - inherit (inputs.std.lib) set list; -in set.map (_: package: prev.callPackage package {} ) (removeAttrs tree.packages ["default"]) +{ + inputs, + tree, + ... +}: _: prev: let + # formerly final: prev:, but deadnix + inherit (inputs.std.lib) set; +in + set.map (_: package: prev.callPackage package {}) (removeAttrs tree.packages ["default"]) diff --git a/pkgs.nix b/pkgs.nix index b827b954..67fc92ad 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -5,4 +5,9 @@ }: let overlays = import tree.overlays {inherit inputs tree;}; in - inputs.utils.lib.eachDefaultSystem (system: {pkgs = import inputs.nixpkgs { inherit system overlays; config.allowUnfree = true; };}) + inputs.utils.lib.eachDefaultSystem (system: { + pkgs = import inputs.nixpkgs { + inherit system overlays; + config.allowUnfree = true; + }; + }) diff --git a/systems/chen.nix b/systems/chen.nix index f1d21856..0c6cf12b 100644 --- a/systems/chen.nix +++ b/systems/chen.nix @@ -1,5 +1,10 @@ _: let - hostConfig = {lib, tree, modulesPath, inputs, pkgs, ...}: let + hostConfig = { + lib, + tree, + inputs, + ... + }: let inherit (lib.modules) mkForce; in { imports = with tree; [ @@ -46,7 +51,7 @@ _: let }; swapDevices = [ - { device = "/dev/sdb"; } + {device = "/dev/sdb";} ]; wsl = { diff --git a/systems/default.nix b/systems/default.nix index 184cfcaa..b19348d2 100644 --- a/systems/default.nix +++ b/systems/default.nix @@ -110,7 +110,7 @@ { inherit machine; systemType = config.folder; - system = config.system; + inherit (config) system; } // defaultSpecialArgs; }; diff --git a/systems/koishi.nix b/systems/koishi.nix index 4a3c78b4..23f7e39a 100644 --- a/systems/koishi.nix +++ b/systems/koishi.nix @@ -1,17 +1,24 @@ _: let - hostConfig = {config, tree, pkgs, ...}: { - imports = with tree.nixos.hardware; [ - lenovo-thinkpad-x260 - common-pc-laptop-ssd - ] ++ (with tree.nixos.roles; [ - graphical - sway - laptop - bootable - ]) ++ (with tree; [ - kat.gui - kat.sway - ]); + hostConfig = { + config, + tree, + ... + }: { + imports = with tree.nixos.hardware; + [ + lenovo-thinkpad-x260 + common-pc-laptop-ssd + ] + ++ (with tree.nixos.roles; [ + graphical + sway + laptop + bootable + ]) + ++ (with tree; [ + kat.gui + kat.sway + ]); fileSystems = { "/" = { @@ -24,7 +31,7 @@ _: let }; }; - services.openssh = { + services.openssh = { hostKeys = [ { bits = 4096; diff --git a/systems/renko.nix b/systems/renko.nix index ddbf670a..ca7f0993 100644 --- a/systems/renko.nix +++ b/systems/renko.nix @@ -1,7 +1,11 @@ _: let - hostConfig = { lib, tree, ... }: let - inherit (lib.modules) mkDefault; - in { + hostConfig = { + lib, + tree, + ... + }: let + inherit (lib.modules) mkDefault; + in { imports = with tree; [ nixos.rosetta nixos.roles.bootable @@ -9,7 +13,7 @@ _: let boot = { loader.systemd-boot.enable = true; - initrd.availableKernelModules = ["virtio_pci" "xhci_pci" "usb_storage" "usbhid" ]; + initrd.availableKernelModules = ["virtio_pci" "xhci_pci" "usb_storage" "usbhid"]; }; fileSystems = { @@ -24,8 +28,8 @@ _: let }; "/run/rosetta" = { - device = "rosetta"; - fsType = "virtiofs"; + device = "rosetta"; + fsType = "virtiofs"; }; }; swapDevices = [ diff --git a/systems/tewi.nix b/systems/tewi.nix deleted file mode 100644 index 2247c4af..00000000 --- a/systems/tewi.nix +++ /dev/null @@ -1,84 +0,0 @@ -_: let - hostConfig = {tree, lib, ...}: let - inherit (lib.modules) mkForce; - in { - imports = with tree; [ - nixos.arc -/* ./kanidm.nix - ./vouch.nix - ./home-assistant.nix - ./zigbee2mqtt.nix - ./mosquitto.nix - ./postgres.nix - ./nginx.nix - ../../gui/nfs.nix */ - ]; - - - networking = { - useDHCP = false; - interfaces = { - eno1 = { - useDHCP = true; - }; - }; - }; - - boot = { - loader = { - systemd-boot = { - enable = true; - }; - efi = { - canTouchEfiVariables = true; - }; - }; - initrd = { - availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; - }; - kernelModules = [ "kvm-intel" ]; - }; - -/* services.openiscsi = { - enable = true; - name = ""; - discoverPortal = "shanghai.tail.cutie.moe"; - }; - - environment.etc."iscsi/initiatorname.iscsi" = mkForce { - source = config.secrets.files.openscsi-config.path; - }; - - secrets.variables.openscsi-password = { - path = "gensokyo/tewi-scsi"; - field = "password"; - }; - - secrets.files.openscsi-config = { - text = "InitiatorName=${tf.variables.openscsi-password.ref}"; - }; */ - - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/6c5d82b1-5d11-4c72-96c6-5f90e6ce57f5"; - fsType = "ext4"; - }; - "/boot" = { - device = "/dev/disk/by-uuid/85DC-72FA"; - fsType = "vfat"; - }; - }; - - swapDevices = lib.singleton ({ - device = "/dev/disk/by-uuid/137605d3-5e3f-47c8-8070-6783ce651932"; - }); - - system.stateVersion = "21.05"; -}; -in { - arch = "x86_64"; - type = "NixOS"; - modules = [ - hostConfig - ]; -} diff --git a/tree.nix b/tree.nix index 8d12c754..d9a347c7 100644 --- a/tree.nix +++ b/tree.nix @@ -1,8 +1,4 @@ -{ - inputs, - pkgs, - ... -}: +{inputs, ...}: (inputs.tree.tree { inherit inputs; folder = ./.;