From 3a29446c9678fe45074f8c96bcf86b8988f41d63 Mon Sep 17 00:00:00 2001 From: Kat Inskip Date: Wed, 15 Feb 2023 15:53:38 -0800 Subject: [PATCH] feat: the stuff of nightmares --- common/overlay.nix | 2 +- flake.lock | 73 +-- flake.nix | 5 +- iac/files.go | 35 +- kat/gui/network.nix | 8 - kat/gui/packages.nix | 8 +- kat/gui/sway.nix | 295 ++++++------ kat/gui/waybar.nix | 188 +++----- kat/gui/waybar.sass | 196 +++----- kat/gui/wofi.nix | 15 +- kat/neovim/init.lua | 3 +- kat/shell/zsh.nix | 4 +- kat/wezterm.nix | 2 + kat_pubkey_ssh.pub | 30 -- modules/home/base16.nix | 17 +- modules/home/waybar.nix | 5 + modules/home/wofi.nix | 34 ++ nixos/arc.nix | 28 +- nixos/common/ssh.nix | 6 +- nixos/gensokyo/home-assistant.nix | 429 ------------------ nixos/gui/network.nix | 49 -- nixos/hardware/.keep | 0 nixos/hardware/bluetooth.nix | 55 +++ nixos/hardware/default.nix | 26 ++ nixos/hardware/laptop.nix | 33 ++ nixos/hardware/lenovo-thinkpad-x260-local.nix | 19 + nixos/{gui => hardware}/sound.nix | 43 +- nixos/hardware/wifi.nix | 26 ++ nixos/i3.nix | 14 - nixos/laptop.nix | 6 - nixos/motd.nix | 5 - nixos/personal.nix | 3 - nixos/{ => roles}/bootable.nix | 0 nixos/{gui => roles/graphical}/fonts.nix | 1 + nixos/{gui => roles/graphical}/gpg.nix | 0 nixos/roles/graphical/hardware.nix | 3 + nixos/{gui => roles/graphical}/nfs.nix | 0 nixos/{gui => roles/graphical}/packages.nix | 0 nixos/{gui => roles/graphical}/pam.nix | 0 nixos/{gui => roles/graphical}/qt.nix | 0 nixos/{gui => roles/graphical}/sway.nix | 0 .../{gui => roles/graphical}/xdg-portals.nix | 0 nixos/{ => roles}/server.nix | 0 nixos/tz.nix | 12 - outputs.nix | 10 +- overlays.nix | 7 +- packages/dart-sass.nix | 19 + packages/default.nix | 3 + pkgs.nix | 2 +- systems/koishi.nix | 45 +- tree.nix | 9 +- 51 files changed, 679 insertions(+), 1094 deletions(-) delete mode 100644 kat/gui/network.nix delete mode 100644 kat_pubkey_ssh.pub create mode 100644 modules/home/waybar.nix create mode 100644 modules/home/wofi.nix delete mode 100644 nixos/gensokyo/home-assistant.nix delete mode 100644 nixos/gui/network.nix create mode 100644 nixos/hardware/.keep create mode 100644 nixos/hardware/bluetooth.nix create mode 100644 nixos/hardware/default.nix create mode 100644 nixos/hardware/laptop.nix create mode 100644 nixos/hardware/lenovo-thinkpad-x260-local.nix rename nixos/{gui => hardware}/sound.nix (61%) create mode 100644 nixos/hardware/wifi.nix delete mode 100644 nixos/i3.nix delete mode 100644 nixos/laptop.nix delete mode 100644 nixos/motd.nix delete mode 100644 nixos/personal.nix rename nixos/{ => roles}/bootable.nix (100%) rename nixos/{gui => roles/graphical}/fonts.nix (94%) rename nixos/{gui => roles/graphical}/gpg.nix (100%) create mode 100644 nixos/roles/graphical/hardware.nix rename nixos/{gui => roles/graphical}/nfs.nix (100%) rename nixos/{gui => roles/graphical}/packages.nix (100%) rename nixos/{gui => roles/graphical}/pam.nix (100%) rename nixos/{gui => roles/graphical}/qt.nix (100%) rename nixos/{gui => roles/graphical}/sway.nix (100%) rename nixos/{gui => roles/graphical}/xdg-portals.nix (100%) rename nixos/{ => roles}/server.nix (100%) delete mode 100644 nixos/tz.nix create mode 100644 packages/dart-sass.nix create mode 100644 packages/default.nix diff --git a/common/overlay.nix b/common/overlay.nix index ec22d9af..260734f2 100644 --- a/common/overlay.nix +++ b/common/overlay.nix @@ -4,7 +4,7 @@ ... }: { nixpkgs = { - overlays = import tree.overlays {inherit inputs;}; + overlays = import tree.overlays {inherit inputs tree;}; config.allowUnfree = true; }; } diff --git a/flake.lock b/flake.lock index 30f81989..626e6806 100644 --- a/flake.lock +++ b/flake.lock @@ -24,11 +24,11 @@ "arcexprs": { "flake": false, "locked": { - "lastModified": 1675450557, - "narHash": "sha256-0Syp+pnuTCjAM9aJAX3DIt6qbAvp/wNeoaGeBn5zmEM=", + "lastModified": 1676227420, + "narHash": "sha256-7l3pbbRRYZAhj5/g8pmtaRg37299KDkyni5YykQn+fw=", "owner": "arcnmx", "repo": "nixexprs", - "rev": "4d4f3a24770be3e60b69cfc191b67f7a1ecbd6a8", + "rev": "3e12ce19adbe3c5e1d87d07bc05abad46877a84e", "type": "github" }, "original": { @@ -126,11 +126,11 @@ ] }, "locked": { - "lastModified": 1675462931, - "narHash": "sha256-JiOUSERBtA1lN/s9YTKGZoZ3XUicHDwr+C8swaPSh3M=", + "lastModified": 1675935446, + "narHash": "sha256-WajulTn7QdwC7QuXRBavrANuIXE5z+08EdxdRw1qsNs=", "owner": "nix-community", "repo": "home-manager", - "rev": "e2c1756e3ae001ca8696912016dd31cb1503ccf3", + "rev": "2dce7f1a55e785a22d61668516df62899278c9e4", "type": "github" }, "original": { @@ -173,11 +173,11 @@ ] }, "locked": { - "lastModified": 1674962474, - "narHash": "sha256-qEXdgW5fnMSdQwP1zQYa0fVtI0f3G1f2qNRjUEherCs=", + "lastModified": 1676172252, + "narHash": "sha256-Q5yJPpgbvOTgB0NQTJmlx3di1Sj5QQhSrjv38u6MzsQ=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "a385f6192f5471c4cebeeb0d2e966b5ccf123df5", + "rev": "89e3b689e0ae9bac4c6cdc24d1085d81baeebde4", "type": "github" }, "original": { @@ -186,13 +186,28 @@ "type": "github" } }, + "nixos-hardware": { + "locked": { + "lastModified": 1675933606, + "narHash": "sha256-y427VhPQHOKkYvkc9MMsL/2R7M11rQxzsRdRLM3htx8=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "44ae00e02e8036a66c08f4decdece7e3bbbefee2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixos-hardware", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1675454231, - "narHash": "sha256-5rgcWq1nFWlbR3NsLqY7i/7358uhkSeMQJ/LEHk3BWA=", + "lastModified": 1676300157, + "narHash": "sha256-1HjRzfp6LOLfcj/HJHdVKWAkX9QRAouoh6AjzJiIerU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "06999209d7a0043d4372e38f57cffae00223d592", + "rev": "545c7a31e5dedea4a6d372712a18e00ce097d462", "type": "github" }, "original": { @@ -205,11 +220,11 @@ "pypi-deps-db": { "flake": false, "locked": { - "lastModified": 1675544670, - "narHash": "sha256-CV3qfT4CdMR9CbyPmbJXMHNgLK0p+62nwM2/yF8QHS0=", + "lastModified": 1676367706, + "narHash": "sha256-FY7MKi/Q6IO4hlYiGqVCrXAg+/VJ/pIVS+ZfqeonOx8=", "owner": "DavHau", "repo": "pypi-deps-db", - "rev": "f822ecb6e8e27ac4e1c34218536658d6be0da51f", + "rev": "1974e03fe3ee9d7246e9af3bedbea72e3ea0535c", "type": "github" }, "original": { @@ -253,6 +268,7 @@ "home-manager": "home-manager", "mach-nix": "mach-nix", "nix-index-database": "nix-index-database", + "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "pypi-deps-db": "pypi-deps-db", "ragenix": "ragenix", @@ -336,26 +352,23 @@ ] }, "locked": { - "lastModified": 1674066361, - "narHash": "sha256-1f7L1be7u3x0jNDJ+W641kM9pZfd2ZLkjziRvKIZMvw=", - "owner": "kittywitch", - "repo": "tree", - "rev": "638ad6549febe360b0120375cae2bc3bb3b477f3", - "type": "github" + "lastModified": 1676402381, + "narHash": "sha256-G/0xP+XfTWK5GbY1qme7gD1E82eAQUuUGUdy+YZ/CQQ=", + "path": "/home/kat/projects/tree", + "type": "path" }, "original": { - "owner": "kittywitch", - "repo": "tree", - "type": "github" + "path": "/home/kat/projects/tree", + "type": "path" } }, "utils": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -377,11 +390,11 @@ ] }, "locked": { - "lastModified": 1675351082, - "narHash": "sha256-4Oi4k4Qp1vOvKoACHDcz0xiVj7DuMaCL57fP3W77eA0=", + "lastModified": 1676381420, + "narHash": "sha256-aDRnfGrk/xi7zkuterN78p8/wdM5Iy6vz74uqd/JFWw=", "owner": "nix-community", "repo": "NixOS-WSL", - "rev": "52cadf92e1bfdef235d5cd77b9a4b2ab848baa8a", + "rev": "4640199aeafcbb63cfbe8318bdf06f4402134f66", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index dcfb6233..a9b5fb98 100644 --- a/flake.nix +++ b/flake.nix @@ -49,10 +49,13 @@ utils.url = "github:numtide/flake-utils"; # file structure -> attrset tree = { - url = "github:kittywitch/tree"; + #url = "github:kittywitch/tree"; + url = "path:/home/kat/projects/tree"; inputs.std.follows = "std"; inputs.nixpkgs.follows = "nixpkgs"; }; + # hardware quirks + nixos-hardware.url = "github:NixOS/nixos-hardware"; # secrets ragenix = { url = "github:yaxitech/ragenix"; diff --git a/iac/files.go b/iac/files.go index cf61050c..96f78161 100644 --- a/iac/files.go +++ b/iac/files.go @@ -2,6 +2,7 @@ package iac import ( "github.com/pulumi/pulumi-command/sdk/go/command/remote" + "github.com/pulumi/pulumi-command/sdk/go/command/local" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -18,13 +19,39 @@ func CreatePulumiFile(ctx *pulumi.Context, name string, fqdn string, value pulum Host: pulumi.String(fqdn), Port: pulumi.Float64Ptr(float64(port)), User: pulumi.String(user), - AgentSocketPath: pulumi.String("/Users/kat/.gnupg/S.gpg-agent.ssh"), + // TODO: note to self, write platform support code here. or just expect env var $SSH_AUTH_SOCK? + AgentSocketPath: pulumi.String("/run/user/1000/gnupg/S.gpg-agent.ssh"), }, Triggers: pulumi.All(resources), - Create: pulumi.Sprintf("sudo mkdir -p /var/lib/secrets && echo \"%s\" | sudo tee \"/var/lib/secrets/%s\"", value, name), - Delete: pulumi.Sprintf("cd /var/lib/secrets && rm %s", name), + Create: pulumi.Sprintf("echo \"%s\" > \"/tmp/%s\" && sudo mkdir -p /var/lib/secrets && sudo install --owner=kat --group=users --mode=0600 \"/tmp/%s\" \"/var/lib/secrets/%s\"", value, name, name, name), + Delete: pulumi.Sprintf("cd /var/lib/secrets && rm \"%s\"", name), Environment: pulumi.StringMap{ "PULUMI_SKIP_UPDATE_CHECK": pulumi.String("true"), }, - }, pulumi.DependsOn(resources), pulumi.IgnoreChanges([]string{"create"})) + }, pulumi.DependsOn(resources), pulumi.IgnoreChanges([]string{})) // within {} put e.g. "create" +} + +func CreatePulumiLocalFile(ctx *pulumi.Context, name string, fqdn string, value pulumi.StringOutput, resources []pulumi.Resource) (*remote.Command, error) { + port := 22 + user := "deploy" + if fqdn == "tewi.inskip.me" { + port = 62954 + user = "root" + } + ctx.Export(name, value) + return remote.NewCommand(ctx, name, &remote.CommandArgs{ + Connection: &remote.ConnectionArgs{ + Host: pulumi.String(fqdn), + Port: pulumi.Float64Ptr(float64(port)), + User: pulumi.String(user), + // TODO: note to self, write platform support code here. or just expect env var $SSH_AUTH_SOCK? + AgentSocketPath: pulumi.String("/run/user/1000/gnupg/S.gpg-agent.ssh"), + }, + Triggers: pulumi.All(resources), + Create: pulumi.Sprintf("echo \"%s\" > \"/tmp/%s\" && sudo mkdir -p /var/lib/secrets && sudo install --owner=kat --group=users --mode=0600 \"/tmp/%s\" \"/var/lib/secrets/%s\"", value, name, name, name), + Delete: pulumi.Sprintf("cd /var/lib/secrets && rm \"%s\"", name), + Environment: pulumi.StringMap{ + "PULUMI_SKIP_UPDATE_CHECK": pulumi.String("true"), + }, + }, pulumi.DependsOn(resources), pulumi.IgnoreChanges([]string{})) // within {} put e.g. "create" } diff --git a/kat/gui/network.nix b/kat/gui/network.nix deleted file mode 100644 index f50b75e5..00000000 --- a/kat/gui/network.nix +++ /dev/null @@ -1,8 +0,0 @@ - -_: { - xsession.preferStatusNotifierItems = true; - services = { - network-manager-applet.enable = true; - blueman-applet.enable = true; - }; - } diff --git a/kat/gui/packages.nix b/kat/gui/packages.nix index e2774feb..e09da91c 100644 --- a/kat/gui/packages.nix +++ b/kat/gui/packages.nix @@ -10,7 +10,8 @@ # Mail thunderbird # Music - spotify + # spotify + playerctl # Chat discord nheko # Matrix @@ -19,6 +20,11 @@ signal-desktop element-desktop mumble-develop + # IDEs + jetbrains.idea-community + jetbrains.pycharm-community + # Exocortex + obsidian # Archivery unzip zip diff --git a/kat/gui/sway.nix b/kat/gui/sway.nix index f0267c7d..01120a8e 100644 --- a/kat/gui/sway.nix +++ b/kat/gui/sway.nix @@ -2,10 +2,12 @@ config, pkgs, lib, + std, ... }: let + inherit (std) list; + inherit (lib.modules) mkMerge; # TODO: fix use of lib - lockCommand = config.programs.swaylock.script; in { programs.zsh.profileExtra = '' # If running from tty1 start sway @@ -50,65 +52,66 @@ in { wayland.windowManager.sway = let cfg = config.wayland.windowManager.sway.config; - - bindsym = k: v: "bindsym ${k} ${v}"; - - bindWorkspace = key: workspace: { - "${cfg.modifier}+${key}" = "workspace number ${workspace}"; - "${cfg.modifier}+shift+${key}" = "move container to workspace number ${workspace}"; - }; - - workspaceBindings = map (v: bindWorkspace v "${v}:${v}") [ - "1" - "2" - "3" - "4" - "5" - "6" - "7" - "8" - "9" - ] ++ [( - bindWorkspace "0" "10:10") - ] ++ lib.imap1 (i: v: bindWorkspace v "${toString (10 + i)}:${v}") [ - "F1" - "F2" - "F3" - "F4" - "F5" - "F6" - "F7" - "F8" - "F9" - "F10" - "F11" - "F12" - ]; - - workspaceBindings' = map (lib.mapAttrsToList bindsym) workspaceBindings; - workspaceBindingsStr = lib.concatStringsSep "\n" (lib.flatten workspaceBindings'); - in { enable = true; config = let - pactl = "${config.home.nixosConfig.hardware.pulseaudio.package or pkgs.pulseaudio}/bin/pactl"; - dmenu = "${pkgs.wofi}/bin/wofi -idbt ${pkgs.wezterm}/bin/wezterm -s ~/.config/wofi/wofi.css -p '' -W 25%"; + super = "Mod4"; + alt = "Mod1"; + actionMode = "(l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown"; + gapsMode = "Gaps: (o) outer, (i) inner"; + gapsOuterMode = "Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)"; + gapsInnerMode = "Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)"; + lockCommand = config.programs.swaylock.script; in { - modes = { - "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown" = { + bars = []; + + modes = let + defaultPath = { + "Return" = "mode default"; + "Escape" = "mode default"; + "${cfg.modifier}+z" = "mode default"; + }; + in { + ${gapsOuterMode} = defaultPath // { + "equal" = "gaps outer current plus 5"; + "minus" = "gaps outer current minus 5"; + "0" = "gaps outer current set 0"; + "plus" = "gaps outer all plus 5"; + "Shift+minus" = "gaps outer all minus 5"; + "Shift+0" = "gaps outer all set 0"; + }; + ${gapsInnerMode} = defaultPath // { + "equal" = "gaps inner current plus 5"; + "minus" = "gaps inner current minus 5"; + "0" = "gaps inner current set 0"; + "plus" = "gaps inner all plus 5"; + "Shift+minus" = "gaps inner all minus 5"; + "Shift+0" = "gaps inner all set 0"; + }; + ${gapsMode} = defaultPath // { + "o" = "mode ${gapsOuterMode}"; + "i" = "mode ${gapsInnerMode}"; + }; + ${actionMode} = defaultPath // { "l" = "exec ${lockCommand}, mode default"; "e" = "exec swaymsg exit, mode default"; "s" = "exec systemctl suspend, mode default"; "h" = "exec systemctl hibernate, mode default"; "r" = "exec systemctl reboot, mode default"; "Shift+s" = "exec systemctl shutdown, mode default"; - "Return" = "mode default"; - "Escape" = "mode default"; + }; + resize = defaultPath // { + "a" = "resize shrink width 4 px or 4 ppt"; + "s" = "resize shrink height 4 px or 4 ppt"; + "w" = "resize grow height 4 px or 4 ppt"; + "d" = "resize grow width 4 px or 4 ppt"; + "Left" = "resize shrink width 4 px or 4 ppt"; + "Down" = "resize shrink height 4 px or 4 ppt"; + "Up" = "resize grow height 4 px or 4 ppt"; + "Right" = "resize grow width 4 px or 4 ppt"; }; }; - bars = []; - input = { "*" = { xkb_layout = "us_gbp_map"; @@ -116,98 +119,153 @@ in { }; }; + gaps = { + smartBorders = "no_gaps"; + }; + fonts = { names = [ "Iosevka"]; style = "Regular"; - size = 12.0; + size = 10.0; }; terminal = "${pkgs.wezterm}/bin/wezterm"; - menu = "${pkgs.j4-dmenu-desktop}/bin/j4-dmenu-desktop --no-generic --dmenu=\"${dmenu}\" --term='${pkgs.wezterm}/bin/wezterm'"; - - modifier = "Mod4"; + modifier = super; startup = [ - { command = "gsettings set org.gnome.desktop.interface cursor-theme 'Quintom_Snow'"; } - { - command = "systemctl --user restart mako"; - always = true; - } { command = "systemctl --user restart konawall.service"; always = true; } ]; - modes.resize = { - "a" = "resize shrink width 4 px or 4 ppt"; - "s" = "resize shrink height 4 px or 4 ppt"; - "w" = "resize grow height 4 px or 4 ppt"; - "d" = "resize grow width 4 px or 4 ppt"; - "Left" = "resize shrink width 4 px or 4 ppt"; - "Down" = "resize shrink height 4 px or 4 ppt"; - "Up" = "resize grow height 4 px or 4 ppt"; - "Right" = "resize grow width 4 px or 4 ppt"; - Return = ''mode "default"''; - Escape = ''mode "default"''; - "${cfg.modifier}+z" = ''mode "default"''; - }; - window = { border = 1; titlebar = false; + hideEdgeBorders = "smart"; }; + workspaceAutoBackAndForth = true; + floating = { border = 1; titlebar = false; }; - keybindings = { - "${cfg.modifier}+Return" = "exec ${cfg.terminal}"; - "${cfg.modifier}+x" = "exec ${lockCommand}"; + keybindings = let + pactl = "${config.home.nixosConfig.hardware.pulseaudio.package or pkgs.pulseaudio}/bin/pactl"; + bindWorkspace = key: workspace: { + "${cfg.modifier}+${key}" = "workspace number ${workspace}"; + "${cfg.modifier}+shift+${key}" = "move container to workspace number ${workspace}"; + }; + workspaceBindings = map (v: bindWorkspace v "${v}") (list.map builtins.toString (list.range 1 9)) ++ [( + bindWorkspace "0" "10") + ] ++ lib.imap1 (i: v: bindWorkspace v "${toString (10 + i)}") (list.map (n: "F${builtins.toString n}") (std.list.range 1 12)); + in mkMerge ([ { + # modes + "${cfg.modifier}+Shift+g" = ''mode "${gapsMode}"''; + "${cfg.modifier}+Delete" = ''mode "${actionMode}"''; - # focus windows - regular + # focus windows - ESDF + "${cfg.modifier}+s" = "focus left"; + "${cfg.modifier}+d" = "focus down"; + "${cfg.modifier}+e" = "focus up"; + "${cfg.modifier}+f" = "focus right"; + + # focus windows - arrows "${cfg.modifier}+Left" = "focus left"; "${cfg.modifier}+Down" = "focus down"; "${cfg.modifier}+Up" = "focus up"; "${cfg.modifier}+Right" = "focus right"; - # move window / container - regular + # move window / container - ESDF + "${cfg.modifier}+Shift+s" = "move left"; + "${cfg.modifier}+Shift+d" = "move down"; + "${cfg.modifier}+Shift+e" = "move up"; + "${cfg.modifier}+Shift+f" = "move right"; + + # move window / container - arrows "${cfg.modifier}+Shift+Left" = "move left"; "${cfg.modifier}+Shift+Down" = "move down"; "${cfg.modifier}+Shift+Up" = "move up"; "${cfg.modifier}+Shift+Right" = "move right"; - # focus output - regular + # focus output - ESDF + "${cfg.modifier}+control+s" = "focus output left"; + "${cfg.modifier}+control+d" = "focus output down"; + "${cfg.modifier}+control+e" = "focus output up"; + "${cfg.modifier}+control+f" = "focus output right"; + + # focus output - arrows "${cfg.modifier}+control+Left" = "focus output left"; "${cfg.modifier}+control+Down" = "focus output down"; "${cfg.modifier}+control+Up" = "focus output up"; "${cfg.modifier}+control+Right" = "focus output right"; - # move container to output - regular + # move container to output - ESDF + "${cfg.modifier}+control+Shift+s" = "move container to output left"; + "${cfg.modifier}+control+Shift+d" = "move container to output down"; + "${cfg.modifier}+control+Shift+e" = "move container to output up"; + "${cfg.modifier}+control+Shift+f" = "move container to output right"; + + # move container to output - arrows "${cfg.modifier}+control+Shift+Left" = "move container to output left"; "${cfg.modifier}+control+Shift+Down" = "move container to output down"; "${cfg.modifier}+control+Shift+Up" = "move container to output up"; "${cfg.modifier}+control+Shift+Right" = "move container to output right"; - # move workspace to output - regular + # move workspace to output - ESDF + "${cfg.modifier}+control+Shift+Mod1+s" = "move workspace to output left"; + "${cfg.modifier}+control+Shift+Mod1+d" = "move workspace to output down"; + "${cfg.modifier}+control+Shift+Mod1+e" = "move workspace to output up"; + "${cfg.modifier}+control+Shift+Mod1+f" = "move workspace to output right"; + + # move workspace to output - arrows "${cfg.modifier}+control+Shift+Mod1+Left" = "move workspace to output left"; "${cfg.modifier}+control+Shift+Mod1+Down" = "move workspace to output down"; "${cfg.modifier}+control+Shift+Mod1+Up" = "move workspace to output up"; "${cfg.modifier}+control+Shift+Mod1+Right" = "move workspace to output right"; - # focus parent/child - "${cfg.modifier}+q" = "focus parent"; - "${cfg.modifier}+e" = "focus child"; + # process management - q + "${cfg.modifier}+q" = "exec ${cfg.menu}"; + "${cfg.modifier}+Shift+q" = "kill"; + "${cfg.modifier}+control+q" = "exec ${cfg.terminal}"; - # floating - "${cfg.modifier}+Shift+space" = "floating toggle"; - "${cfg.modifier}+space" = "focus mode_toggle"; + # focus parent/child - w + "${cfg.modifier}+w" = "focus parent"; + "${cfg.modifier}+Shift+w" = "focus child"; + # unused control - # workspace history switching + # split management - a + "${cfg.modifier}+a" = "splith"; + "${cfg.modifier}+Shift+a" = "splitv"; + "${cfg.modifier}+control+A" = "layout toggle split"; + + # resizing, reloading - r + # unused base + "${cfg.modifier}+Shift+r" = "mode resize"; + "${cfg.modifier}+control+r" = "reload"; + + # layout handling - t + "${cfg.modifier}+t" = "layout tabbed"; + "${cfg.modifier}+Shift+t" = "layout stacking"; + "${cfg.modifier}+control+t" = "fullscreen toggle"; + + # locking - l + "${cfg.modifier}+l" = "exec ${lockCommand}"; + # unused shift + # unused control + "control+${alt}+Delete" = "exec ${lockCommand}"; + + # floating - p + "${cfg.modifier}+p" = "focus mode_toggle"; + "${cfg.modifier}+Shift+p" = "floating toggle"; + # unused control + + # workspace history switching - tab "${cfg.modifier}+Tab" = "workspace back_and_forth"; "${cfg.modifier}+Shift+Tab" = "exec ${config.services.i3gopher.focus-last}"; + # unused control # multimedia / laptop "XF86AudioPlay" = "exec --no-startup-id ${pkgs.playerctl}/bin/playerctl play-pause"; @@ -218,26 +276,8 @@ in { "XF86AudioMicMute" = "exec --no-startup-id ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle"; "XF86MonBrightnessDown" = "exec ${pkgs.light}/bin/light -U 5"; "XF86MonBrightnessUp" = "exec ${pkgs.light}/bin/light -A 5"; - - # dmenu - "${cfg.modifier}+r" = "exec ${cfg.menu}"; - - # layout handling - "${cfg.modifier}+b" = "splith"; - "${cfg.modifier}+v" = "splitv"; - "${cfg.modifier}+o" = "layout stacking"; - "${cfg.modifier}+i" = "layout tabbed"; - "${cfg.modifier}+h" = "layout toggle split"; - "${cfg.modifier}+f" = "fullscreen"; - - # sway specific - "${cfg.modifier}+Shift+q" = "kill"; - "${cfg.modifier}+Shift+c" = "reload"; - - # mode triggers - "${cfg.modifier}+Shift+r" = "mode resize"; - "${cfg.modifier}+Delete" = ''mode "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown"''; - }; + } + ] ++ workspaceBindings); colors = let inherit (config.base16) palette; @@ -271,55 +311,14 @@ in { childBorder = palette.base08; }; }; + + seat.seat0.xcursor_theme = ''"Quintom Snow" 20''; }; wrapperFeatures.gtk = true; extraConfig = '' - hide_edge_borders smart_no_gaps - smart_borders no_gaps title_align center - seat seat0 xcursor_theme Quintom_Snow 20 - workspace_auto_back_and_forth yes - set $mode_gaps Gaps: (o) outer, (i) inner - set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global) - set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global) - bindsym ${cfg.modifier}+Shift+g mode "$mode_gaps" - - mode "$mode_gaps" { - bindsym o mode "$mode_gaps_outer" - bindsym i mode "$mode_gaps_inner" - bindsym Return mode "default" - bindsym Escape mode "default" - } - - mode "$mode_gaps_inner" { - bindsym equal gaps inner current plus 5 - bindsym minus gaps inner current minus 5 - bindsym 0 gaps inner current set 0 - - bindsym plus gaps inner all plus 5 - bindsym Shift+minus gaps inner all minus 5 - bindsym Shift+0 gaps inner all set 0 - - bindsym Return mode "default" - bindsym Escape mode "default" - } - - mode "$mode_gaps_outer" { - bindsym equal gaps outer current plus 5 - bindsym minus gaps outer current minus 5 - bindsym 0 gaps outer current set 0 - - bindsym plus gaps outer all plus 5 - bindsym Shift+minus gaps outer all minus 5 - bindsym Shift+0 gaps outer all set 0 - - bindsym Return mode "default" - bindsym Escape mode "default" - } - - ${workspaceBindingsStr} ''; }; } diff --git a/kat/gui/waybar.nix b/kat/gui/waybar.nix index cfa7209a..879ef836 100644 --- a/kat/gui/waybar.nix +++ b/kat/gui/waybar.nix @@ -1,138 +1,88 @@ { kittywitch, pkgs, ... }: { - xdg.configFile."waybar/style.css" = { inherit (kittywitch.sassTemplate { name = "waybar-style"; src = ./waybar.sass; }) source; }; - programs.waybar = { enable = true; + style = let + template = kittywitch.sassTemplate { name = "waybar-style"; src = ./waybar.sass; }; + in template.source; systemd.enable = true; - settings = [{ - height = 10; + settings.main = { + layer = "top"; + position = "top"; + height = 18; + + # Modules Placement modules-left = [ "sway/workspaces" - "sway/mode" - "sway/window" + "sway/mode" + "sway/window" ]; modules-center = [ + "custom/clock" + "mpris" ]; modules-right = [ - "pulseaudio#icon" - "pulseaudio" - "cpu" - "custom/memory-icon" - "memory" - "temperature#icon" - "temperature" - "battery#icon" - "battery" - "backlight#icon" - "backlight" - "network#icon" - "network" - "idle_inhibitor" - "custom/clock" - "tray" - ]; + "network" + "temperature" + "idle_inhibitor" + "tray" + ]; - "sway/workspaces" = { - format = "{icon}"; - format-icons = { - "1" = "1:"; - "2" = "2:"; - "3" = "3:"; - }; + # Modules Definition + "sway/workspaces" = { + format = "{icon}"; + format-icons = { + "1" = ""; + "2" = ""; + "3" = ""; + "4" = ""; + "5" = ""; }; - "sway/window" = { - icon = true; - icon-size = 12; - format = "{}"; + }; + "sway/window" = { + format = "{}"; + }; + tray = { + show-passive-items = true; + icon-size = 12; + spacing = 2; + }; + mpris = { + format = "{player_icon} {dynamic}"; + format-paused = "{status_icon} {dynamic}"; + player-icons = { + default = ""; + brave = ""; + mpv = ""; + spotify = ""; }; - tray = { - icon-size = 12; - spacing = 2; + status-icons = { + paused = ""; }; - "backlight#icon" = { - format = "{icon}"; - format-icons = ["" ""]; + }; + temperature = { + format = " {temperatureC}°C"; + critical-threshold = 80; + }; + idle_inhibitor = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; }; - backlight = { - format = "{percent}%"; - }; - "custom/cpu-icon".format = ""; - cpu.format = "{usage}%"; - "custom/memory-icon".format = ""; - memory.format = "{percentage}%"; - "temperature#icon" = { - format = "{icon}"; - format-icons = ["" "" ""]; - critical-threshold = 80; - }; - temperature = { - format = "{temperatureC}°C"; - critical-threshold = 80; - }; - idle_inhibitor = { - format = "{icon}"; - format-icons = { - activated = ""; - deactivated = ""; - }; - }; - "battery#icon" = { - states = { - good = 90; - warning = 30; - critical = 15; - }; - format = "{icon}"; - format-charging = ""; - format-plugged = ""; - format-icons = [ "" "" "" "" "" ]; - }; - battery = { - states = { - good = 90; - warning = 30; - critical = 15; - }; - format = "{capacity}%"; - format-charging = "{capacity}%"; - format-plugged = "{capacity}%"; - format-alt = "{time}"; - }; - "pulseaudio#icon" = { - format = "{icon}"; - format-muted = "婢"; - on-click = "wezterm start pulsemixer"; - format-icons = { - default = [ - "" - "" - "" - ]; - }; - }; - pulseaudio = { - format = "{volume}%"; - on-click = "${pkgs.wezterm}/bin/wezterm start ${pkgs.pulsemixer}/bin/pulsemixer"; - }; - "network#icon" = { - format-wifi = "直"; - format-ethernet = ""; - format-linked = " "; - format-disconnected = ""; - }; - network = { - format-wifi = "{essid} ({signalStrength}%)"; - format-ethernet = "{ipaddr}/{cidr}"; - format-linked = "No IP"; - format-disconnected = "Disconnected"; - format-alt = "{ifname}: {ipaddr}/{cidr}"; - }; - "custom/clock" = { - exec = ''${pkgs.coreutils}/bin/date +"%a, %F %T %Z"''; - interval = 1; - }; - }]; + }; + network = { + format-wifi = " {essid} ({signalStrength}%)"; + format-ethernet = " {ipaddr}/{cidr}"; + format-linked = " No IP"; + format-disconnected = " Disconnected"; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + }; + "custom/clock" = { + exec = ''${pkgs.coreutils}/bin/date +"%a, %F %T %Z"''; + interval = 1; + }; + }; }; } diff --git a/kat/gui/waybar.sass b/kat/gui/waybar.sass index b0e9d35f..8d58b1c9 100644 --- a/kat/gui/waybar.sass +++ b/kat/gui/waybar.sass @@ -1,154 +1,31 @@ -%extend_1 - padding: 0 8px - transition: none - color: $base00 - * + padding: 0 + margin: 0 border: none border-radius: 0 background: none font-family: "Iosevka", "Font Awesome 6 Free", "Font Awesome 6 Brands" font-size: $font_size - min-height: 8px text-shadow: none box-shadow: none -window#waybar - background: $base00t - -tooltip - background: $base00t - label - color: $base07 - -#mode +%widget_unpadded + transition: none background: $base01 - color: $base06 + color: $base07 + margin: 0 4px + +%widget + @extend %widget_unpadded padding: 0 4px -#clock, #custom-clock - @extend %extend_1 - background: $base01 - color: $base07 - -#cpu, #memory, #temperature, #pulseaudio, #backlight, #battery, #custom-mail, #custom-headset, #clock.arc, #clock.hex, #clock.miku, #network - background: $base01 - color: $base07 - padding: 0 6px - margin-right: 4px - -#custom-gpg-status, #custom-konawall, #idle_inhibitor - margin: 0 4px - -#temperature.icon, #pulseaudio.icon, #battery.icon, #backlight.icon, #custom-cpu-icon, #custom-memory-icon, #custom-mail-icon, #custom-headset-icon, #custom-arc-h, #custom-hex-h, #custom-miku-h, #clock.original, #tray, #network.icon - margin-left: 4px - margin-right: 0px - -#custom-headset-icon - @extend %extend_1 - background: $base06 - -#custom-memory-icon - @extend %extend_1 - background: $base09 - -#custom-cpu-icon - @extend %extend_1 - background: $base08 - -#temperature.icon - @extend %extend_1 - background: $base0B - -#pulseaudio.icon - @extend %extend_1 - background: $base06 - &.muted - background: $base03 - -#network.icon - @extend %extend_1 - background: $base0C - -#mpd - @extend %extend_1 - -#backlight.icon - @extend %extend_1 - background: $base0D - -#battery.icon - @extend %extend_1 - background: $base0C - -#custom-mail-icon - @extend %extend_1 - background: $base0F - -#custom-konawall - @extend %extend_1 - &.enabled - background: $base0E - - &.disabled - background: $base0D - -#custom-gpg-status - @extend %extend_1 - &.enabled - background: $base0B - - &.disabled - background: $base08 - -#idle_inhibitor - @extend %extend_1 - &.activated - background: $base0E - - &.deactivated - background: $base0D - -#tray - @extend %extend_1 - background: $base01 - padding: 0 10px 0 8px - menu - background: $base00t - color: $base07 - - -.modules-left - margin: 0 4px - image - padding-left: 6px - padding-right: 6px - margin-left: 4px - margin-right: 0px - background: $base01 - #window - margin-left: 0px - margin-right: 0px - widget - label - margin: 0 - - &:first-child - margin-left: 0 - - &:last-child - margin-right: 0 - -.modules-center - margin: 0 4px - -.modules-right - margin: 0 4px +window#waybar + background: color.change($base00, $alpha: 0.9) + border-bottom: 2px solid transparent +// sway/workspaces #workspaces - background: $base01 - padding: 0 - margin-right: 8px + @extend %widget_unpadded button color: $base06 &.focused @@ -162,11 +39,46 @@ tooltip background: $base06 color: $base0C -#window - background: $base01 - padding: 0 4px - color: $base06 - border-bottom: 2px solid transparent +// widgets +#mode, window#waybar #window, +#custom-clock, #mpris, +#pulseaudio, #backlight, #network, #temperature, #battery, #idle_inhibitor, #tray, #tray menu + @extend %widget + +// hide when empty window#waybar.empty #window opacity: 0 + + +// tooltips +tooltip + background: color.change($base00, $alpha: 0.9) + label + color: $base07 + +// mpris player and state +#mpris + &.spotify + background: #191414 + color: #1DB954 + + &.paused + background: $base01 + color: $base03 + +/*.modules-left + #window + widget + label + margin: 0 + + &:first-child + margin-left: 0 + + &:last-child + margin-right: 0*/ + +.modules-center + +.modules-right diff --git a/kat/gui/wofi.nix b/kat/gui/wofi.nix index 13fa1504..3b3fffe5 100644 --- a/kat/gui/wofi.nix +++ b/kat/gui/wofi.nix @@ -1,3 +1,16 @@ { kittywitch, ... }: { - xdg.configFile."wofi/wofi.css" = { inherit (kittywitch.sassTemplate { name = "wofi-style"; src = ./wofi.sass; }) source; }; + programs.wofi = { + enable = true; + settings = { + style = let + template = kittywitch.sassTemplate { name = "wofi-style"; src = ./wofi.sass; }; + in template.source; + insensitive = true; + allow_images = true; + hide_scroll = true; + width = "25%"; + mode = "dmenu"; + prompt = ""; + }; + }; } diff --git a/kat/neovim/init.lua b/kat/neovim/init.lua index 76223bde..3a0d5381 100644 --- a/kat/neovim/init.lua +++ b/kat/neovim/init.lua @@ -101,7 +101,8 @@ opt.listchars = { -- Memory, CPU ----------------------------------------------------------- opt.hidden = true -- Enable background buffers -opt.history = 100 -- Remember N lines in history +opt.history = 1000 -- Remember N lines in history +opt.shada = "'1000,f1,<500,@500,/500" opt.lazyredraw = true -- Faster scrolling opt.synmaxcol = 240 -- Max column for syntax highlight opt.updatetime = 700 -- ms to wait for trigger an event diff --git a/kat/shell/zsh.nix b/kat/shell/zsh.nix index 03f50f09..0fe1aabb 100644 --- a/kat/shell/zsh.nix +++ b/kat/shell/zsh.nix @@ -11,6 +11,9 @@ in { home.packages = with pkgs; [ # programs.zsh.enableAutosuggestions only includes nix-zsh-autocompletions zsh-completions + fortune + neofetch + ponysay ]; xdg.configFile."kattheme_immutable.json".text = serde.toJSON rec { @@ -86,7 +89,6 @@ in { '' else "" } - ${pkgs.fortune}/bin/fortune | ${pkgs.ponysay}/bin/ponysay ''; shellAliases = mkMerge [ { diff --git a/kat/wezterm.nix b/kat/wezterm.nix index d1bcda15..85b65494 100644 --- a/kat/wezterm.nix +++ b/kat/wezterm.nix @@ -4,6 +4,8 @@ _: { extraConfig = '' local wezterm = require 'wezterm'; return { + font = wezterm.font "Iosevka", + font_size = 9.0, check_for_updates = false, show_update_window = false, enable_tab_bar = true diff --git a/kat_pubkey_ssh.pub b/kat_pubkey_ssh.pub deleted file mode 100644 index 1023b953..00000000 --- a/kat_pubkey_ssh.pub +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFIDCCAwigAwIBAgIQG9WOE1qLWgtuL6Q2y3y2MDANBgkqhkiG9w0BAQsFADAp -MRMwEQYDVQQKEwpLYXQgSW5za2lwMRIwEAYDVQQDEwlpbnNraXAubWUwIBcNMjMw -MjAzMjI0NzIzWhgPMjMxNTA1MTYyMTQ3MjNaMCkxEzARBgNVBAoTCkthdCBJbnNr -aXAxEjAQBgNVBAMTCWluc2tpcC5tZTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC -AgoCggIBAM7I9jWXlaK9li4mhDcQfuAk8R6mfJvFj5X/Lih+Icq/+9dHEsbTy06G -1KkksRRs2dYbp2/WKtaWJpeLlTgN1J3xkwtqMkXdiXsEEF6DXvowlnS5RLIh5+TW -WFjBqVJQ6F0CR0UtMGMRhS31s7LV95HHA2QetdL1BoMIxDNPh3idfiJfRItooRHG -xa+4z/WQv37xFolUQ3032pbrBWEbYBbZxc3Bd/nW0VKof0QVbf392h3HiGx0kegr -I3VfNW8OPy+FeYpqYpzjOQrBxC+viPm2To5BHqySzx/X7kp0auAFSnEQ0etruGeQ -aAr59HE/m0kdWr2MuQIRMj+E1ZkZT9oZ7w2pyO7KTmA3oNS3sFiw0v+zlB21zqqu -R8J3r9utxfSAlfRh8kx+X2qcOZKvpxsha3DYtaDUWGAftoB8rM3Mqnh+3Yx8hlW/ -omhgCbsiVD8QmX0ylz0d9a2KrpFTcCNtrjizUXM4YTZf7PlZNHiznhg9s1OsoyeL -JgoK1DWb8wNmSlQmM521Y8U/mOGRMCkkgzpkjSz1BVwLSSt5eWW8G0gYShWI/muV -IyUxynQ4hjQDdAkp8RXuPdngfURJv9mak2+A5twYkYYJsjs+ybGK+nW11oSQHRZZ -rgTtNuuAvsRNH4LMEckTnl4EXDdBW45qviSlRbS6uUYMXBhYULObAgMBAAGjQjBA -MA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBStOuqq -aSal/ZDjfDd/5woNkfZbWDANBgkqhkiG9w0BAQsFAAOCAgEAXfjvG57cmZI9H9uS -CymF5uyoDM80D9fTf1jzNpCMf+K0YcS4VztKVn752CRCMAQzhzt/pl8zg1UC7fbN -VgXEe2V7bXAf/Jimy+39eBEZBBXXcUjZMWpYqHceHXkL+qpasOvYZUPTTzAXnEo+ -wafSUr07G7P68vO4xIM1JQ+GOvsn85/VvLU8FnKges5PaINOPEcSGfaf9r0fzHs+ -JXbXu+PgYBnJus85Q6yDpgJe63xkvUaDGmZDQ1OgEqH8a20xTj1JF6QnDo6h6ZI7 -7PZGta6WroxBzmaV5+WqBgQeU/X4CqmdaItYN8V9toTpn4P15ixZD7Wf9B+wwjkb -ISGWIALq0G/+UNO7tz1YYVV4vMc2ihwOly8PALIjtEkXcwKwDW4hcvEdUwoEpR2x -9+VQjtkLAFYc22UixurMRtTqqIEGbr3vDzK9g6T0ybqkihVY+2V46fV1hkOV7x4c -BKfjMQu0KOT+i3DGUzwGlGftTQZra7EXVeregwKCQ1+ir7oOjOj/3a5dyRvueEBV -OXBmCdbQqNxEb9AufzetdDEQ7P7jcxCD0hEk0IMZ+jG/I5etZAP67LeuGkSI6Mtd -M3zZ1XVewnSYMBojKdM8bAN/r8qs6vlk4s+/WhOhH8/BgP1GsxSml0vk466SqufA -14acmvYZwS3osOl7wz0Y6XANkD8= ------END CERTIFICATE----- \ No newline at end of file diff --git a/modules/home/base16.nix b/modules/home/base16.nix index 7d6f8196..bb8c2fcf 100644 --- a/modules/home/base16.nix +++ b/modules/home/base16.nix @@ -7,13 +7,10 @@ in with lib; { palette = mkOption { type = attrsOf str; }; - palette' = mkOption { - type = attrsOf str; - }; sass = { variables = mkOption { type = attrsOf str; - default = cfg.palette // cfg.palette' // { + default = cfg.palette // { term_font = "Iosevka"; font = "Iosevka"; font_size = "12px"; @@ -28,16 +25,10 @@ in with lib; { config = mkIf (cfg.schemes != {}) { base16 = { # TODO: convert to std - palette = lib.mapAttrs' (k: v: + palette = lib.mapAttrs' (k: v: lib.nameValuePair k - "#${v.hex}") - (lib.filterAttrs (n: _: lib.hasInfix "base" n) - cfg.defaultScheme); - palette' = lib.mapAttrs' (k: v: - lib.nameValuePair - "${k}t" - "rgba(${toString v.red.byte}, ${toString v.green.byte}, ${toString v.blue.byte}, ${toString 0.7})") + "#${v.hex}") (lib.filterAttrs (n: _: lib.hasInfix "base" n) cfg.defaultScheme); }; @@ -50,7 +41,7 @@ in with lib; { source = pkgs.callPackage ({ sass, stdenv }: stdenv.mkDerivation { inherit name src variables; - nativeBuildInputs = lib.singleton sass; + nativeBuildInputs = lib.singleton pkgs.sass; phases = [ "buildPhase" ]; buildPhase = '' cat $variables $src > src-mut.sass diff --git a/modules/home/waybar.nix b/modules/home/waybar.nix new file mode 100644 index 00000000..8fc6677b --- /dev/null +++ b/modules/home/waybar.nix @@ -0,0 +1,5 @@ +{ config, ... }: { + systemd.user.services.waybar.Unit.X-Restart-Triggers = [ + (builtins.toString config.programs.waybar.style) + ]; +} diff --git a/modules/home/wofi.nix b/modules/home/wofi.nix new file mode 100644 index 00000000..382831fb --- /dev/null +++ b/modules/home/wofi.nix @@ -0,0 +1,34 @@ +{ config, lib, pkgs, ... }: let + inherit (lib.modules) mkIf mkMerge; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) attrsOf unspecified; + inherit (lib.generators) toKeyValue; + cfg = config.programs.wofi; +in { + options.programs.wofi = { + enable = mkEnableOption "wofi, an unmaintained launcher program for wlroots"; + package = mkOption { + type = unspecified; + default = pkgs.wofi; + }; + exec = mkOption { + internal = true; + type = unspecified; + default = "${cfg.package}/bin/wofi"; + }; + settings = mkOption { + type = attrsOf unspecified; + }; + }; + config = mkMerge [ + { + programs.wofi.settings.term = config.wayland.windowManager.sway.config.terminal; + } + (mkIf cfg.enable { + xdg.configFile."wofi/config" = { + text = toKeyValue {} cfg.settings; + }; + wayland.windowManager.sway.config.menu = "${pkgs.j4-dmenu-desktop}/bin/j4-dmenu-desktop --no-generic --dmenu=\"${cfg.exec}\" --term='${cfg.settings.term}'"; + }) + ]; +} diff --git a/nixos/arc.nix b/nixos/arc.nix index 14e99a9d..861f4fb1 100644 --- a/nixos/arc.nix +++ b/nixos/arc.nix @@ -1,17 +1,13 @@ -{ ... }: { - imports = [ - ({ config, pkgs, ... }: +({ config, pkgs, ... }: - { - users.users.arc = { - uid = 1001; - isNormalUser = true; - extraGroups = [ "wheel" ]; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ8Z6briIboxIdedPGObEWB6QEQkvxKvnMW/UVU9t/ac mew-pgp" - ]; - shell = pkgs.zsh; - }; - }) - ]; -} + { + 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/ssh.nix b/nixos/common/ssh.nix index f4403fd4..3b70c173 100644 --- a/nixos/common/ssh.nix +++ b/nixos/common/ssh.nix @@ -9,10 +9,10 @@ in { services.openssh = { enable = true; - knownHosts.katca = { +/* knownHosts.katca = { certAuthority = true; - publicKey = builtins.readFile ../../kat_pubkey_ssh.pub; - }; + publicKey = builtins.readFile ./ca-pubkey.pem; + }; */ kexAlgorithms = [ "curve25519-sha256@libssh.org" ]; settings = { PasswordAuthentication = false; diff --git a/nixos/gensokyo/home-assistant.nix b/nixos/gensokyo/home-assistant.nix deleted file mode 100644 index 9277c283..00000000 --- a/nixos/gensokyo/home-assistant.nix +++ /dev/null @@ -1,429 +0,0 @@ -{ config, lib, tf, ... }: let - inherit (lib.attrsets) attrNames filterAttrs mapAttrs' nameValuePair; - inherit (lib.strings) hasPrefix; -in { - # MDNS - services.avahi.enable = true; - - networking.firewall = { - allowedTCPPorts = [ - 8123 # Home Assistant - 21036 # HomeKit - ]; - allowedUDPPorts = [ - 5353 # MDNS - ]; - allowedUDPPortRanges = [ - { from = 32768; to = 60999; } # Chromecast - ]; - }; - - networks.gensokyo = { - tcp = [ - # Home Assistant - 8123 - # Tewi Homekit - 21063 - ]; - udp = [ - # Chromecast - [ 32768 60999 ] - # MDNS - 5353 - ]; - }; - - secrets.variables.ha-integration = { - path = "gensokyo/home-assistant"; - field = "notes"; - }; - - secrets.files.ha-integration = { - text = tf.variables.ha-integration.ref; - owner = "hass"; - group = "hass"; - }; - - secrets.variables.latitude = { - path = "gensokyo/home-assistant"; - field = "latitude"; - }; - - secrets.variables.longitude = { - path = "gensokyo/home-assistant"; - field = "longitude"; - }; - - secrets.variables.elevation = { - path = "gensokyo/home-assistant"; - field = "elevation"; - }; - - secrets.variables.iphone-se-irk = { - path = "gensokyo/home-assistant"; - field = "iphone-se-irk"; - }; - secrets.variables.companion-pixel6 = { - path = "gensokyo/home-assistant"; - field = "companion-pixel6"; - }; - secrets.variables.tile-bee = { - path = "gensokyo/home-assistant"; - field = "tile-bee"; - }; - secrets.variables.tile-kat-wallet = { - path = "gensokyo/home-assistant"; - field = "tile-kat-wallet"; - }; - secrets.variables.tile-kat-keys = { - path = "gensokyo/home-assistant"; - field = "tile-kat-keys"; - }; - secrets.variables.mpd-shanghai-password = { - path = "gensokyo/abby"; - field = "mpd"; - }; - - secrets.files.home-assistant-secrets = { - text = let - espresenceDevices = { - iphone-se-irk = tf.variables.iphone-se-irk.ref; - companion-pixel6 = tf.variables.companion-pixel6.ref; - tile-kat-wallet = tf.variables.tile-kat-wallet.ref; - tile-kat-keys = tf.variables.tile-kat-keys.ref; - tile-bee = tf.variables.tile-bee.ref; - }; - in builtins.toJSON ({ - latitude = tf.variables.latitude.ref; - longitude = tf.variables.longitude.ref; - elevation = tf.variables.elevation.ref; - mpd-shanghai-password = tf.variables.mpd-shanghai-password.ref; - } // espresenceDevices // mapAttrs' (key: device_id: - nameValuePair "${key}-topic" "espresense/devices/${device_id}" - ) espresenceDevices); - owner = "hass"; - group = "hass"; - }; - - systemd.services.home-assistant = { - preStart = lib.mkBefore '' - cp --no-preserve=mode ${config.secrets.files.home-assistant-secrets.path} ${config.services.home-assistant.configDir}/secrets.yaml - cp --no-preserve=mode ${config.secrets.files.ha-integration.path} ${config.services.home-assistant.configDir}/integration.yaml - # UI-editable config files - touch ${config.services.home-assistant.configDir}/{automations,scenes,scripts,manual}.yaml - ''; - }; - - services.home-assistant = { - enable = true; - config = { - homeassistant = { - name = "Gensokyo"; - unit_system = "metric"; - latitude = "!secret latitude"; - longitude = "!secret longitude"; - elevation = "!secret elevation"; - currency = "CAD"; - time_zone = "America/Vancouver"; - external_url = "https://home.gensokyo.zone"; - packages = { - manual = "!include manual.yaml"; - }; - }; - frontend = { - themes = "!include_dir_merge_named themes"; - }; - powercalc = { - }; - utility_meter = { - }; - withings = { - use_webhook = true; - }; - logger = { - default = "info"; - }; - http = { - cors_allowed_origins = [ - "https://google.com" - "https://www.home-assistant.io" - ]; - use_x_forwarded_for = "true"; - trusted_proxies = [ - "127.0.0.0/24" - "200::/7" - "100.64.0.0/10" - "fd7a:115c:a1e0:ab12::/64" - ]; - }; - recorder = { - db_url = "postgresql://@/hass"; - auto_purge = true; - purge_keep_days = 14; - commit_interval = 1; - exclude = { - domains = [ - "automation" - "updater" - ]; - entity_globs = [ - "sensor.weather_*" - "sensor.date_*" - ]; - entities = [ - "sun.sun" - "sensor.last_boot" - "sensor.date" - "sensor.time" - ]; - event_types = [ - "call_service" - ]; - }; - }; - google_assistant = { - project_id = "gensokyo-5cfaf"; - service_account = "!include integration.yaml"; - report_state = true; - exposed_domains = [ - "scene" - "script" - "climate" - #"sensor" - ]; - entity_config = let - hidden = "XYZ"; - in { - # bedroom entities - "light.bedside_lamp".expose = true; - "light.bedroom_strip".expose = true; - "light.bedroom_overhead".expose = true; - "light.bed_side_overhead".room = hidden; - "light.closet_side_overhead".room = hidden; - "light.pc_side_overhead".room = hidden; - "light.closet_overhead".expose = true; - "light.closet_overhead_left".room = hidden; - "light.closet_overhead_right".room = hidden; - "fan.bedroom_purifier" = { - expose = true; - aliases = [ - "FÖRNUFTIG" - "Bedroom Air Purifier" - ]; - }; - "fan.bedroom_floor".expose = true; - "switch.swb1_relay_3".expose = true; - "switch.swb1_relay_4".expose = true; - - # living room entities - "light.dining_overhead".expose = true; - "light.living_cluster".expose = true; - "light.living_overhead".room = hidden; - "light.tv_overhead".room = hidden; - "light.couch_overhead_left".room = hidden; - "light.couch_overhead_right".room = hidden; - "light.tv_bias" = { - room = hidden; - aliases = [ - "Bias Lighting" - "TV Backlight" - ]; - }; - "light.living_bookshelf".room = hidden; - # midea - "climate.living_ac".aliases = [ - "AC" - "Midea" - ]; - "sensor.living_ac_outdoor_temperature".expose = false; - - # kitchen - "light.kitchen_overhead".expose = true; - "light.kitchen_overhead_inner".room = hidden; - "light.kitchen_overhead_middle".room = hidden; - "light.kitchen_overhead_outer".room = hidden; - - # balcony - "light.outdoor_strip".expose = true; - "light.lantern".expose = true; - - # foyer - "light.entry_overhead".expose = true; - "light.entry_overhead_left".room = hidden; - "light.entry_overhead_right".room = hidden; - - # shanghai systemd - "switch.shanghai_graphical".expose = true; - "switch.shanghai_mradio".expose = true; - "switch.shanghai_vm_goliath1650".expose = true; - "switch.shanghai_vm_goliath3080".expose = true; - "switch.shanghai_vm_hourai1650".expose = true; - "switch.shanghai_vm_hourai3080".expose = true; - "cover.shanghai_dpms" = { - expose = true; - aliases = [ - "DPMS" - ]; - }; - }; - }; - homekit = { - name = "Tewi"; - port = 21063; - ip_address = "10.1.1.38"; - filter = let - inherit (config.services.home-assistant.config) google_assistant; - entities = filterAttrs (_: entity: entity.expose or true) google_assistant.entity_config; - in { - include_domains = google_assistant.exposed_domains; - include_entities = attrNames (removeAttrs entities [ - # HomeKit is able to group lights together, no need to use the google hack here - "light.living_cluster" - "light.bedroom_overhead" - "light.closet_overhead" - "light.kitchen_overhead" - "light.entry_overhead" - ]); - }; - entity_config = { - "switch.swb1_relay_3".type = "outlet"; - "switch.swb1_relay_4".type = "outlet"; - }; - }; - tts = [{ - platform = "google_translate"; - service_name = "google_say"; - }]; - # https://nixos.wiki/wiki/Home_Assistant#Combine_declarative_and_UI_defined_automations - "automation manual" = [ ]; - "automation ui" = "!include automations.yaml"; - # https://nixos.wiki/wiki/Home_Assistant#Combine_declarative_and_UI_defined_scenes - "scene manual" = []; - "scene ui" = "!include scenes.yaml"; - "script manual" = []; - "script ui" = "!include scripts.yaml"; - counter = {}; - device_tracker = {}; - energy = {}; - group = {}; - history = {}; - image = {}; - input_boolean = {}; - input_button = {}; - input_datetime = {}; - input_number = {}; - input_select = {}; - input_text = {}; - logbook = {}; - schedule = {}; - map = {}; - media_source = {}; - media_player = [ - { - platform = "mpd"; - name = "Shanghai MPD"; - host = "10.1.1.32"; - password = "!secret mpd-shanghai-password"; - } - ]; - mobile_app = {}; - my = {}; - person = {}; - ssdp = {}; - switch = {}; - stream = {}; - sun = {}; - system_health = {}; - tag = {}; - template = {}; - tile = {}; - timer = {}; - webhook = {}; - wake_on_lan = {}; - zeroconf = {}; - zone = {}; - sensor = let - mkESPresenceBeacon = { device_id, ... }@args: { - platform = "mqtt_room"; - state_topic = if hasPrefix "!secret" device_id - then "${device_id}-topic" - else "espresense/devices/${device_id}"; - } // args; - in [ - (mkESPresenceBeacon { - device_id = "!secret iphone-se-irk"; - name = "iPhone SE"; - timeout = 2; - away_timeout = 120; - }) - (mkESPresenceBeacon { - device_id = "!secret companion-pixel6"; - name = "Kat's Pixel 6"; - timeout = 5; - away_timeout = 120; - }) - (mkESPresenceBeacon { - device_id = "name:galaxy-watch-active"; - name = "Galaxy Watch Active"; - }) - (mkESPresenceBeacon { - device_id = "3003c8383b6c"; - name = "MT7922 BT"; - }) - (mkESPresenceBeacon { - device_id = "d8f8833681ba"; - name = "AX210 BT"; - }) - (mkESPresenceBeacon { - device_id = "md:03ff:6"; - name = "Kat's Smartwatch"; - }) - (mkESPresenceBeacon { - device_id = "!secret tile-bee"; - name = "Bee"; - }) - (mkESPresenceBeacon { - device_id = "!secret tile-kat-wallet"; - name = "Kat's Wallet"; - }) - (mkESPresenceBeacon { - device_id = "!secret tile-kat-keys"; - name = "Girlwife"; - }) - ]; - }; - extraPackages = python3Packages: with python3Packages; [ - psycopg2 - aiohomekit - securetar - getmac # for upnp integration - (aiogithubapi.overrideAttrs (_: { doInstallCheck = false; })) - ]; - extraComponents = [ - "automation" - "scene" - "script" - "zha" - "esphome" - "apple_tv" - "spotify" - "default_config" - "brother" - "ipp" - "cast" - "plex" - "met" - "google" - "google_assistant" - "google_cloud" - "google_translate" - "homekit" - "mpd" - "mqtt" - "tile" - "wake_on_lan" - "withings" - "zeroconf" - ]; - }; -} diff --git a/nixos/gui/network.nix b/nixos/gui/network.nix deleted file mode 100644 index ca3dfede..00000000 --- a/nixos/gui/network.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ lib, pkgs, ... }: let -inherit (lib.modules) mkForce; -in { - systemd.services.NetworkManager-wait-online = { - serviceConfig.ExecStart = [ "" "${pkgs.networkmanager}/bin/nm-online -q" ]; - }; - hardware.bluetooth = { - enable = true; - package = pkgs.bluez5-experimental; - settings = { - General = { - Enable = "Source,Sink,Media,Socket"; - }; - }; - }; - services.blueman.enable = true; - services.pipewire.media-session.config.bluez-monitor = { - properties = { }; - rules = [ - { - actions = { - update-props = { - "bluez5.a2dp-source-role" = "input"; - "bluez5.auto-connect" = [ "hfp_hf" "hsp_hs" "a2dp_sink" "a2dp_source" "hsp_ag" "hfp_ag" ]; - }; - }; - matches = [ { "device.name" = "~bluez_card.*"; } ]; - } - { - actions = { - update-props = { "node.pause-on-idle" = false; }; - }; - matches = [ { "node.name" = "~bluez_input.*"; } { "node.name" = "~bluez_output.*"; } ]; - } - ]; - }; - networking = { - firewall = { - allowedUDPPorts = [ 5353 ]; - allowedUDPPortRanges = [ { from = 32768; to=60999; } ]; - }; - networkmanager = { - enable = true; - connectionConfig = { - "ipv6.ip6-privacy" = mkForce 0; - }; - }; - }; -} diff --git a/nixos/hardware/.keep b/nixos/hardware/.keep new file mode 100644 index 00000000..e69de29b diff --git a/nixos/hardware/bluetooth.nix b/nixos/hardware/bluetooth.nix new file mode 100644 index 00000000..70f010b3 --- /dev/null +++ b/nixos/hardware/bluetooth.nix @@ -0,0 +1,55 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ bluez5-experimental ]; + + environment.etc = { + "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' + bluez_monitor.properties = { + ["bluez5.enable-sbc-xq"] = true, + ["bluez5.enable-msbc"] = true, + ["bluez5.enable-hw-volume"] = true, + ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]" + } + ''; + }; + + hardware.bluetooth = { + enable = true; + package = pkgs.bluez5-experimental; + settings = { + General = { + Enable = "Source,Sink,Media,Socket"; + }; + }; + }; + + services = { + blueman.enable = true; + pipewire.media-session.config.bluez-monitor = { + properties = { }; + rules = [ + { + actions = { + update-props = { + "bluez5.a2dp-source-role" = "input"; + "bluez5.auto-connect" = [ "hfp_hf" "hsp_hs" "a2dp_sink" "a2dp_source" "hsp_ag" "hfp_ag" ]; + }; + }; + matches = [ { "device.name" = "~bluez_card.*"; } ]; + } + { + actions = { + update-props = { "node.pause-on-idle" = false; }; + }; + matches = [ { "node.name" = "~bluez_input.*"; } { "node.name" = "~bluez_output.*"; } ]; + } + ]; + }; + }; + + home-manager.sharedModules = [ + { + xsession.preferStatusNotifierItems = true; + services.blueman-applet.enable = true; + } + ]; +} diff --git a/nixos/hardware/default.nix b/nixos/hardware/default.nix new file mode 100644 index 00000000..c9f27b4f --- /dev/null +++ b/nixos/hardware/default.nix @@ -0,0 +1,26 @@ +{ lib, tree, ... }: with lib; let + profiles = tree.prev; + appendedProfiles = { + common-wifi-bt = { + imports = with profiles; [ + wifi + bluetooth + ]; + }; + laptop = { + imports = with profiles; [ + laptop + sound + ]; + }; + lenovo-thinkpad-x260 = { + imports = with profiles; [ + lenovo-thinkpad-x260 + lenovo-thinkpad-x260-local + appendedProfiles.laptop + appendedProfiles.common-wifi-bt + ]; + }; + }; +in +profiles // appendedProfiles diff --git a/nixos/hardware/laptop.nix b/nixos/hardware/laptop.nix new file mode 100644 index 00000000..4124e069 --- /dev/null +++ b/nixos/hardware/laptop.nix @@ -0,0 +1,33 @@ +{lib, pkgs, ...}: let +inherit (lib.modules) mkDefault mkOrder; +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; + }; + 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 new file mode 100644 index 00000000..108fd560 --- /dev/null +++ b/nixos/hardware/lenovo-thinkpad-x260-local.nix @@ -0,0 +1,19 @@ +{lib, ...}: let +in { + boot = { + 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"; + }; + } + ]; +} diff --git a/nixos/gui/sound.nix b/nixos/hardware/sound.nix similarity index 61% rename from nixos/gui/sound.nix rename to nixos/hardware/sound.nix index 098fa361..94b7bc41 100644 --- a/nixos/gui/sound.nix +++ b/nixos/hardware/sound.nix @@ -1,4 +1,8 @@ -{ pkgs, ... }: { +{lib, pkgs, ...}: let +inherit (lib.modules) mkDefault mkOrder; +in { + environment.systemPackages = with pkgs; [ pulsemixer ]; + sound = { enable = true; extraConfig = '' @@ -6,21 +10,8 @@ ''; }; - environment.systemPackages = with pkgs; [ pulsemixer bluez5-experimental ]; - security.rtkit.enable = true; - environment.etc = { - "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' - bluez_monitor.properties = { - ["bluez5.enable-sbc-xq"] = true, - ["bluez5.enable-msbc"] = true, - ["bluez5.enable-hw-volume"] = true, - ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]" - } - ''; - }; - services.pipewire = { enable = true; config = { @@ -49,4 +40,28 @@ jack.enable = true; alsa.enable = true; }; + + 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 = [ + "" + "" + "" + ]; + }; + }; + }; + } + ]; } diff --git a/nixos/hardware/wifi.nix b/nixos/hardware/wifi.nix new file mode 100644 index 00000000..90ecc50a --- /dev/null +++ b/nixos/hardware/wifi.nix @@ -0,0 +1,26 @@ +{ lib, pkgs, ... }: let +inherit (lib.modules) mkForce; +in { + systemd.services.NetworkManager-wait-online = { + serviceConfig.ExecStart = [ "" "${pkgs.networkmanager}/bin/nm-online -q" ]; + }; + networking = { + firewall = { + allowedUDPPorts = [ 5353 ]; # MDNS + allowedUDPPortRanges = [ { from = 32768; to=60999; } ]; # Ephemeral / Chromecast + }; + networkmanager = { + enable = true; + connectionConfig = { + "ipv6.ip6-privacy" = mkForce 0; + }; + }; + }; + + home-manager.sharedModules = [ + { + xsession.preferStatusNotifierItems = true; + services.network-manager-applet.enable = true; + } + ]; +} diff --git a/nixos/i3.nix b/nixos/i3.nix deleted file mode 100644 index 34c67fb2..00000000 --- a/nixos/i3.nix +++ /dev/null @@ -1,14 +0,0 @@ -_: let - super = "Mod4"; -in { - xsession.windowManager.i3 = { - enable = true; - config = { - modifier = super; - fonts = [ ]; - }; - - bars = [ - ]; - }; -} diff --git a/nixos/laptop.nix b/nixos/laptop.nix deleted file mode 100644 index 86b56922..00000000 --- a/nixos/laptop.nix +++ /dev/null @@ -1,6 +0,0 @@ -{lib, ...}: let - inherit (lib.modules) mkDefault; -in { - powerManagement.cpuFreqGovernor = mkDefault "powersave"; - programs.light.enable = true; -} diff --git a/nixos/motd.nix b/nixos/motd.nix deleted file mode 100644 index a303e45f..00000000 --- a/nixos/motd.nix +++ /dev/null @@ -1,5 +0,0 @@ -_: { - programs.rust-motd = { - enable = true; - }; -} diff --git a/nixos/personal.nix b/nixos/personal.nix deleted file mode 100644 index eaa706ac..00000000 --- a/nixos/personal.nix +++ /dev/null @@ -1,3 +0,0 @@ -_: { - services.fstrim.enable = true; -} diff --git a/nixos/bootable.nix b/nixos/roles/bootable.nix similarity index 100% rename from nixos/bootable.nix rename to nixos/roles/bootable.nix diff --git a/nixos/gui/fonts.nix b/nixos/roles/graphical/fonts.nix similarity index 94% rename from nixos/gui/fonts.nix rename to nixos/roles/graphical/fonts.nix index 8b1a165e..14e9951f 100644 --- a/nixos/gui/fonts.nix +++ b/nixos/roles/graphical/fonts.nix @@ -1,6 +1,7 @@ { pkgs, ... }: { fonts = { fonts = with pkgs; [ + font-awesome twitter-color-emoji iosevka-bin ]; diff --git a/nixos/gui/gpg.nix b/nixos/roles/graphical/gpg.nix similarity index 100% rename from nixos/gui/gpg.nix rename to nixos/roles/graphical/gpg.nix diff --git a/nixos/roles/graphical/hardware.nix b/nixos/roles/graphical/hardware.nix new file mode 100644 index 00000000..be395d25 --- /dev/null +++ b/nixos/roles/graphical/hardware.nix @@ -0,0 +1,3 @@ +_: { + hardware.enableAllFirmware = true; +} diff --git a/nixos/gui/nfs.nix b/nixos/roles/graphical/nfs.nix similarity index 100% rename from nixos/gui/nfs.nix rename to nixos/roles/graphical/nfs.nix diff --git a/nixos/gui/packages.nix b/nixos/roles/graphical/packages.nix similarity index 100% rename from nixos/gui/packages.nix rename to nixos/roles/graphical/packages.nix diff --git a/nixos/gui/pam.nix b/nixos/roles/graphical/pam.nix similarity index 100% rename from nixos/gui/pam.nix rename to nixos/roles/graphical/pam.nix diff --git a/nixos/gui/qt.nix b/nixos/roles/graphical/qt.nix similarity index 100% rename from nixos/gui/qt.nix rename to nixos/roles/graphical/qt.nix diff --git a/nixos/gui/sway.nix b/nixos/roles/graphical/sway.nix similarity index 100% rename from nixos/gui/sway.nix rename to nixos/roles/graphical/sway.nix diff --git a/nixos/gui/xdg-portals.nix b/nixos/roles/graphical/xdg-portals.nix similarity index 100% rename from nixos/gui/xdg-portals.nix rename to nixos/roles/graphical/xdg-portals.nix diff --git a/nixos/server.nix b/nixos/roles/server.nix similarity index 100% rename from nixos/server.nix rename to nixos/roles/server.nix diff --git a/nixos/tz.nix b/nixos/tz.nix deleted file mode 100644 index ab3cd276..00000000 --- a/nixos/tz.nix +++ /dev/null @@ -1,12 +0,0 @@ -_: { - services.tzupdate.enable = true; - systemd.timers.tzupdate = { - description = "Attempt to update timezone every hour"; - timerConfig = { - OnBootSec="1m"; - OnUnitInactiveSec="1h"; - Unit = "tzupdate.service"; - }; - wantedBy = [ "timers.target" ]; - }; -} diff --git a/outputs.nix b/outputs.nix index ffcb1233..52d3e999 100644 --- a/outputs.nix +++ b/outputs.nix @@ -1,12 +1,16 @@ {inputs}: let std = import ./std.nix {inherit inputs;}; - tree = import ./tree.nix {inherit inputs;}; + tree = import ./tree.nix {inherit inputs pkgs;}; inherit (inputs.nixpkgs) lib; + overlay = import ./packages {inherit inputs tree lib std;}; systems = import ./systems {inherit inputs tree lib std;}; shells = import ./shells {inherit inputs tree lib std pkgs;}; - inherit (import ./pkgs.nix {inherit inputs tree;}) pkgs; + 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; in - {inherit inputs tree std pkgs checks formatter lib;} // systems // shells + { + inherit inputs tree std pkgs checks formatter lib; + legacyPackages = pkgs; + } // systems // shells diff --git a/overlays.nix b/overlays.nix index e7de77dd..1fa1deb5 100644 --- a/overlays.nix +++ b/overlays.nix @@ -1,7 +1,6 @@ -{inputs, ...}: -[ +{inputs, tree, ...}: [ inputs.deploy-rs.overlay -] -++ map (path: import "${path}/overlay.nix") [ + (import tree.packages.default { inherit inputs tree; }) +] ++ map (path: import "${path}/overlay.nix") [ inputs.arcexprs ] diff --git a/packages/dart-sass.nix b/packages/dart-sass.nix new file mode 100644 index 00000000..84c9efc3 --- /dev/null +++ b/packages/dart-sass.nix @@ -0,0 +1,19 @@ +{ stdenv, fetchurl, autoPatchelfHook }: + +stdenv.mkDerivation rec { + pname = "dart-sass"; + version = "1.58.1"; + + src = fetchurl { + url = + "https://github.com/sass/${pname}/releases/download/${version}/${pname}-${version}-linux-x64.tar.gz"; + sha256 = "sha256-5/mEeshCakp/eju9MhFZ8VXvHEuXGiDVtUI2UhI0XPU="; + }; + + nativeBuildInputs = [ autoPatchelfHook ]; + + installPhase = '' + mkdir -p $out/bin + mv sass $out/bin + ''; +} diff --git a/packages/default.nix b/packages/default.nix new file mode 100644 index 00000000..635656ee --- /dev/null +++ b/packages/default.nix @@ -0,0 +1,3 @@ +{ inputs, tree, ... }: final: prev: let + inherit (inputs.std.lib) set list; +in set.map (_: package: prev.callPackage package {} ) (removeAttrs tree.packages ["default"]) diff --git a/pkgs.nix b/pkgs.nix index fe661ae9..b827b954 100644 --- a/pkgs.nix +++ b/pkgs.nix @@ -3,6 +3,6 @@ inputs, ... }: let - overlays = import tree.overlays {inherit inputs;}; + overlays = import tree.overlays {inherit inputs tree;}; in inputs.utils.lib.eachDefaultSystem (system: {pkgs = import inputs.nixpkgs { inherit system overlays; config.allowUnfree = true; };}) diff --git a/systems/koishi.nix b/systems/koishi.nix index bcde4b31..68b9715f 100644 --- a/systems/koishi.nix +++ b/systems/koishi.nix @@ -1,10 +1,15 @@ _: let hostConfig = {config, tree, pkgs, ...}: { - imports = with tree; [ - nixos.gui - nixos.bootable + imports = with tree.nixos.hardware; [ + lenovo-thinkpad-x260 + common-pc-laptop-ssd + ] ++ (with tree.nixos.roles; [ + graphical + laptop + bootable + ]) ++ (with tree; [ kat.gui - ]; + ]); fileSystems = { "/" = { @@ -17,7 +22,7 @@ _: let }; }; - services.openssh = { + services.openssh = { hostKeys = [ { bits = 4096; @@ -31,7 +36,7 @@ _: let ]; extraConfig = '' HostCertificate /var/lib/secrets/${config.networking.hostName}-osh-cert - HostCertificate /var/lib/secrets/${config.networking.hostName}-ed25519-osh-cert + HostCertificate /var/lib/secrets/${config.networking.hostName}-osh-ed25519-cert ''; }; @@ -39,35 +44,7 @@ _: let {device = "/dev/disk/by-uuid/0d846453-95b4-46e1-8eaf-b910b4321ef0";} ]; - 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"; - }; - } - ]; - - hardware = { - cpu.intel.updateMicrocode = true; - opengl = { - enable = true; - extraPackages = with pkgs; [ - intel-media-driver - vaapiIntel - vaapiVdpau - libvdpau-va-gl - ]; - }; - }; - boot = { - initrd.availableKernelModules = - [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "sr_mod" "rtsx_usb_sdmmc" ]; - kernelModules = [ "kvm-intel" ]; supportedFilesystems = ["xfs"]; initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/f0ea08b4-6af7-4d90-a2ad-edd5672a2105"; loader = { diff --git a/tree.nix b/tree.nix index 163e3f57..3e4a8e46 100644 --- a/tree.nix +++ b/tree.nix @@ -1,4 +1,4 @@ -{inputs, ...}: +{inputs, pkgs, ...}: (inputs.tree.tree { inherit inputs; folder = ./.; @@ -11,6 +11,7 @@ "tree" "inputs" "outputs" + "pkgs" ]; }; # Ignore the default.nix we actually use @@ -32,6 +33,9 @@ "kat/user/data".evaluate = true; # Allow profile importing "nixos/*".functor.enable = true; + "nixos/roles/*".functor.enable = true; + "nixos/hardware".evaluateDefault = true; + "nixos/hardware/*".functor.enable = true; "darwin/*".functor.enable = true; "kat/*".functor.enable = true; # Various modules @@ -40,6 +44,9 @@ enable = true; }; }; + "nixos/hardware" = { + external = inputs.nixos-hardware.outputs.nixosModules; + }; "modules/nixos" = { functor = { enable = true;