greenhouse

kore

my public infrastructure monorepo

git clone [email protected]:kore.git

revert(e40e93c): "feat(*): fuck u windows"

this reverts commit e40e93c9b467e74003d103d5b1a5b576ced42285.
commit09c930dea05f995b8fcb5ea716d3e3e72998f77e
parent3cd94b6a82605868ab129c6d1f6b796ff4f741ed
authorlostduk <[email protected]>
date2026-02-07 08:30 +0000
.gitignore2-
flake.lock55++++++++++---------
flake.nix7+--
home/features/cli/ssh.nix11----
home/features/global.nix16+-----
home/features/wayland/dwl.nix5--
home/features/wayland/foot.nix12-----
home/profiles/sunflower.nix20++++++-
nixos/features/global.nix63+---------------------
nixos/hosts/sunflower.nix72+++----------------------
nixos/roles/workstation.nix115+--------------------------------------
overlays/default.nix10----
overlays/dwl_config.h118----------------------------------------

13 files changed, -443/+63

.gitignore

@@ -1,2 +0,0 @@-# build-result

flake.lock

@@ -1,22 +1,18 @@ {   "nodes": {-    "disko": {-      "inputs": {-        "nixpkgs": [-          "nixpkgs"-        ]-      },+    "flake-compat": {+      "flake": false,       "locked": {-        "lastModified": 1764627417,-        "narHash": "sha256-D6xc3Rl8Ab6wucJWdvjNsGYGSxNjQHzRc2EZ6eeQ6l4=",-        "owner": "nix-community",-        "repo": "disko",-        "rev": "5a88a6eceb8fd732b983e72b732f6f4b8269bef3",+        "lastModified": 1761588595,+        "narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=",+        "owner": "edolstra",+        "repo": "flake-compat",+        "rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5",         "type": "github"       },       "original": {-        "owner": "nix-community",-        "repo": "disko",+        "owner": "edolstra",+        "repo": "flake-compat",         "type": "github"       }     },@@ -27,11 +23,11 @@         ]       },       "locked": {-        "lastModified": 1764603455,-        "narHash": "sha256-Q70rxlbrxPcTtqWIb9+71rkJESxIOou5isZBvyOieXw=",+        "lastModified": 1764304195,+        "narHash": "sha256-bO7FN/bF6gG7TlZpKAZjO3VvfsLaPFkefeUfJJ7F/7w=",         "owner": "~rycee",         "repo": "home-manager",-        "rev": "effe4c007d6243d9e69ce2242d76a2471c1b8d5c",+        "rev": "86ff0ef506c209bb397849706e85cc3a913cb577",         "type": "sourcehut"       },       "original": {@@ -40,28 +36,34 @@         "type": "sourcehut"       }     },-    "impermanence": {+    "nixos-wsl": {+      "inputs": {+        "flake-compat": "flake-compat",+        "nixpkgs": [+          "nixpkgs"+        ]+      },       "locked": {-        "lastModified": 1737831083,-        "narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=",+        "lastModified": 1764072830,+        "narHash": "sha256-ezkjlUCohD9o9c47Ey0/I4CamSS0QEORTqGvyGqMud0=",         "owner": "nix-community",-        "repo": "impermanence",-        "rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170",+        "repo": "NixOS-WSL",+        "rev": "c7832dd786175e20f2697179e0e03efadffe4201",         "type": "github"       },       "original": {         "owner": "nix-community",-        "repo": "impermanence",+        "repo": "NixOS-WSL",         "type": "github"       }     },     "nixpkgs": {       "locked": {-        "lastModified": 1764517877,-        "narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=",+        "lastModified": 1764242076,+        "narHash": "sha256-sKoIWfnijJ0+9e4wRvIgm/HgE27bzwQxcEmo2J/gNpI=",         "owner": "nixos",         "repo": "nixpkgs",-        "rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c",+        "rev": "2fad6eac6077f03fe109c4d4eb171cf96791faa4",         "type": "github"       },       "original": {@@ -73,9 +75,8 @@     },     "root": {       "inputs": {-        "disko": "disko",         "home-manager": "home-manager",-        "impermanence": "impermanence",+        "nixos-wsl": "nixos-wsl",         "nixpkgs": "nixpkgs"       }     }

flake.nix

@@ -1,11 +1,10 @@ {   inputs = {     nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";-    impermanence.url = "github:nix-community/impermanence";--    disko.url = "github:nix-community/disko";-    disko.inputs.nixpkgs.follows = "nixpkgs"; +    nixos-wsl.url = "github:nix-community/NixOS-WSL";+    nixos-wsl.inputs.nixpkgs.follows = "nixpkgs";+         home-manager.url = "sourcehut:~rycee/home-manager";     home-manager.inputs.nixpkgs.follows = "nixpkgs";   };

home/features/cli/ssh.nix

@@ -1,11 +0,0 @@-{-  programs.ssh = {-    enable = true;-    matchBlocks = {-      gh = {-        hostname = "github.com";-        user = "git";-      };-    }; -  };-}

home/features/global.nix

@@ -1,8 +1,6 @@-{ inputs, config, pkgs, ... }:+{ config, pkgs, ... }:  {-  imports = [ inputs.impermanence.nixosModules.home-manager.impermanence ];-   home = {     username = "lostduk";     homeDirectory = "/home/lostduk";@@ -16,16 +14,6 @@       GOTOOLCHAIN = "local";     }; -    packages = with pkgs; [ firefox pass goofcord ];--    persistence."/persist/home/lostduk" = {-      allowOther = true;-      directories = [-        "documents"-        ".mozilla" -        ".config/goofcord" -        ".password-store"-      ];-    };+    packages = with pkgs; [ pass ];   }; }

home/features/wayland/dwl.nix

@@ -1,5 +0,0 @@-{ pkgs, ... }:--{-  home.packages = with pkgs; [ dwl dmenu wl-clipboard xdg-utils ];-}

home/features/wayland/foot.nix

@@ -1,12 +0,0 @@-{-  programs.foot = {-    enable = true;--    settings = {-      main = {-        font = "ComicShannsMono Nerd Font:size=11";-        line-height = "16px";-      };-    };-  };-}

home/profiles/sunflower.nix

@@ -1,15 +1,27 @@ {   imports = [     ../features/cli/gpg.nix-    ../features/cli/ssh.nix     ../features/cli/git.nix     ../features/cli/nvim.nix     ../features/cli/bash.nix     ../features/cli/tmux.nix      ../features/misc/xdg.nix--    ../features/wayland/dwl.nix-    ../features/wayland/foot.nix   ];++  # TMP: neovim suck tbh but it work+  programs.neovim.extraConfig = ''+    let g:clipboard = {+      \   'name': 'WslClipboard',+      \   'copy': {+      \      '+': 'clip.exe',+      \      '*': 'clip.exe',+      \    },+      \   'paste': {+      \      '+': 'powershell.exe -NoLogo -NoProfile -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',+      \      '*': 'powershell.exe -NoLogo -NoProfile -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',+      \   },+      \   'cache_enabled': 0,+      \ }+  ''; }

nixos/features/global.nix

@@ -1,8 +1,6 @@-{ inputs, outputs, config, lib, pkgs, ... }:+{ inputs, outputs, lib, pkgs, ... }:  {-  imports = [ inputs.impermanence.nixosModules.impermanence ];-   i18n.defaultLocale = "en_US.UTF-8";   time.timeZone = "UTC"; @@ -70,7 +68,7 @@      audit = {       enable = true;-      rules = [ "-a exit,always -F arch=b64 -S execve" ];+      rules = [ "-a exit,always, -F arch=b64 -S execve" ];     };      sudo = {@@ -88,60 +86,5 @@     users.root.hashedPassword = lib.mkForce "!";   }; -  environment = {-    defaultPackages = lib.mkForce [];--    persistence."/persist" = {-      hideMounts = false;--      directories = [-        "/srv"-        "/var/lib/nixos"-        "/var/lib/systemd"-      ];-    };-  };--  boot.initrd = let-    rootDevice = config.fileSystems."/".device;-    systemdStage1 = config.boot.initrd.systemd.enable;-    # TODO: Delete old root, but I can't get this to work since something-    # is wrong. In the "Creating a new root" part, our root is not /@, but it's-    # /@_(date) I'm not sure why. Maybe it works as intended since i wrote this-    # a long, long time ago.-    script = ''-      echo "Mounting..."-      mkdir -p /tmp-      MNTPOINT=$(mktemp -d)-      (-        mount ${rootDevice} "$MNTPOINT"-        trap 'umount "$MNTPOINT"' EXIT--        echo "Creating a new root..."-        mv "$MNTPOINT/@" "$MNTPOINT/@_$(date "+%Y-%m-%-d_%H:%M:%S")"--        echo "Creating a blank subvolume..."-        btrfs sub cre "$MNTPOINT/@"-      )-    '';-  in {-    supportedFilesystems = [ "btrfs" ];-    postDeviceCommands = lib.mkIf (!systemdStage1) (lib.mkBefore script);--    systemd.services.wipe-root = lib.mkIf (systemdStage1) {-      description = "Wipe root";-      wantedBy = [ "initrd.target" ];-      requires = [ "dev-mapper-crypted.device" ];-      before = [ "sysroot.mount" ];-      after = [-        "dev-mapper-crypted.device"-        "[email protected]"-      ];-      unitConfig.DefaultDependencies = "no";-      serviceConfig.type = "oneshot";-      script = script;-    };-  };--  fileSystems."/persist".neededForBoot = true;+  environment.defaultPackages = lib.mkForce []; }

nixos/hosts/sunflower.nix

@@ -2,22 +2,19 @@  {   imports = [-    inputs.disko.nixosModules.disko+    inputs.nixos-wsl.nixosModules.default      ( modulesPath + "/installer/scan/not-detected.nix" )   ]; -  boot = {-    kernelModules = [ "kvm-intel" ];+  wsl = {+    enable = true;+    defaultUser = "lostduk";+    useWindowsDriver = true; -    loader = {-      systemd-boot.enable = true;-      efi.canTouchEfiVariables = true;-    };--    initrd = {-      systemd.enable = true;-      availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];+    usbip = {+      enable = true;+      autoAttach = [ "1-14" ];     };   }; @@ -31,58 +28,7 @@   };    hardware = {-    graphics = {-      enable = true;-      extraPackages = with pkgs; [ libGL ];-    };+    graphics.enable = true;     cpu.intel.updateMicrocode = true;   };--  disko.devices.disk.main = {-    type = "disk";-    device = "/dev/sda";-    content = {-      type = "gpt";-      partitions = {-        ESP = {-          size = "512M";-          type = "EF00";-          content = {-            type = "filesystem";-            format = "vfat";-            mountpoint = "/boot";-            mountOptions = [ "defaults" "uid=0" "gid=0" "fmask=0077" "dmask=0077" ];-          };-        };-        luks = {-          size = "100%";-          content = {-            name = "crypted";-            type = "luks";-            extraFormatArgs = [ "--type luks2" ];-            content = {-              type = "btrfs";-              extraArgs = [ "-f" ];-              subvolumes = let-                options = [ "compress=zstd" "noatime" "space_cache=v2" "discard=async" "ssd" ];-              in {-                "/@" = {-                  mountpoint = "/";-                  mountOptions = options;-                };-                "/@nix" = {-                  mountpoint = "/nix";-                  mountOptions = options;-                };-                "/@persist" = {-                  mountpoint = "/persist";-                  mountOptions = options;-                };-              };-            };-          };-        };-      };-    };-  }; }

nixos/roles/workstation.nix

@@ -1,4 +1,4 @@-{ inputs, outputs, config, pkgs, lib, ... }:+{ inputs, outputs, config, lib, ... }:  let   roleName = "workstation";@@ -14,117 +14,6 @@ in {        users.lostduk = outputs.homeConfigurations.${config.networking.hostName};     };--    environment.etc."fuse.conf".text = ''-      user_allow_other-      mount_max = 1000-    '';--    xdg.portal = {-      enable = true;-      extraPortals = [ pkgs.xdg-desktop-portal-wlr ];-      configPackages = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ];--      wlr.enable = true;--      config.common = {-        default = [ "wlr" ];-      };-    };--    system.activationScripts.persistent-dirs.text =-      let-        mkHomePersist = user: lib.optionalString user.createHome ''-          mkdir -p /persist/${user.home}-          chown ${user.name}:${user.group} /persist/${user.home}-          chmod ${user.homeMode} /persist/${user.home}-        '';-        users = lib.attrValues config.users.users;-      in lib.concatLines (map mkHomePersist users);--    fonts = {-      enableDefaultPackages = false;--      packages = with pkgs; [-        noto-fonts-        noto-fonts-cjk-sans-        noto-fonts-cjk-serif-        noto-fonts-color-emoji--        #(nerdfonts.override { fonts = [ "ComicShannsMono" ]; })-        nerd-fonts.comic-shanns-mono-      ];--      fontconfig = {-        hinting.autohint = true;--        defaultFonts = {-          serif = [ "Noto Serif" "Noto Color Emoji" ];-          sansSerif = [ "Noto Sans" "Noto Color Emoji" ];-          monospace = [ "ComicShannsMono Nerd Font" "Noto Color Emoji" ];-          emoji = [ "Noto Color Emoji" ];-        };-      };-    };--    services = {-      udisks2.enable = true;--      pipewire = {-        enable = true;--        alsa.enable = true;-        alsa.support32Bit = true;--        pulse.enable = true;-        jack.enable = true;--        wireplumber = {-          enable = true;--          # https://github.com/NixOS/nixpkgs/pull/292115-          extraConfig."alsa-lowlatency" = {-            "monitor.alsa.rules" = [{-              matches = [{ "node.name" = "~alsa_output.*"; }];--              actions.update-props = {-                "audio.format" = "S32LE";-                "audio.rate" = "96000";-                "api.alsa.period-size" = 2;-              };-            }];-          };-        };--        extraConfig.pipewire."92-low-latency" = {-          context = {-            properties.default.clock = {-              rate = 48000;-              quantum = 64;-            };--            modules = [{-              name = "libpipewire-module-protocol-pulse";--              args.pulse = {-                min = {-                  req = "64/48000";-                  quantum = "64/48000";-                  frag = "64/48000";-                };--                default.req = "64/48000";-              };-            }];-          };-          -          stream.properties = {-            node.latency = "64/48000";-            resample.quality = 1;-          };-        };-      };-    };-  })]; +  })]; } 

overlays/default.nix

@@ -13,14 +13,4 @@       )       inputs;   };--  modifications = final: prev: {-    dwl = prev.dwl.overrideAttrs (oldAttrs: {-      enableXWayland = true;-      -      postPatch = ''-        cp ${./dwl_config.h} config.h-      '';-    });-  }; }

overlays/dwl_config.h

@@ -1,118 +0,0 @@-/* general */-#define TAGCOUNT (6)--static int log_level                       = WLR_ERROR;-static const int sloppyfocus               = 1;-static const int bypass_surface_visibility = 0;--/* appearance */-static const unsigned int borderpx         = 1;-static const float rootcolor[]             = {0.1f, 0.1f, 0.1f, 1.0f};-static const float bordercolor[]           = {0.2f, 0.2f, 0.2f, 1.0f};-static const float focuscolor[]            = {0.0f, 0.3f, 0.4f, 1.0f};-static const float urgentcolor[]           = {0.1f, 0.0f, 0.0f, 1.0f};-static const float fullscreen_bg[]         = {0.1f, 0.1f, 0.1f, 1.0f};--/* rules */-static const Rule rules[] = {-	{ "Gimp_EXAMPLE", NULL, 0, 1, -1 },-};--/* layouts */-static const Layout layouts[] = {-	{ "[T]", tile },-	{ "[F]", NULL },-	{ "[M]", monocle },-};--/* monitors */-static const MonitorRule monrules[] = {-	{ NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },-};--/* keyboard */-static const int repeat_rate = 25;-static const int repeat_delay = 600;--static const struct xkb_rule_names xkb_rules = {-	.layout = "us,th",-	.options = "grp:alt_shift_toggle",-};---/* trackpad */-static const int tap_to_click = 1;-static const int tap_and_drag = 1;-static const int drag_lock = 1;-static const int natural_scrolling = 0;-static const int disable_while_typing = 1;-static const int left_handed = 0;-static const int middle_button_emulation = 0;--static const enum libinput_config_scroll_method scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;-static const enum libinput_config_click_method click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;-static const uint32_t send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;-static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;-static const double accel_speed = 0.0;-static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;--/* commands */-#define MODKEY WLR_MODIFIER_LOGO-#define MODALT WLR_MODIFIER_ALT-#define MODCTRL WLR_MODIFIER_CTRL-#define MODSHIFT WLR_MODIFIER_SHIFT--#define TAGKEYS(KEY, SKEY, TAG) \-	{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \-	{ MODKEY|MODCTRL, KEY, toggleview, {.ui = 1 << TAG} }, \-	{ MODKEY|MODSHIFT, SKEY, tag, {.ui = 1 << TAG} }, \-	{ MODKEY|MODCTRL|MODSHIFT, SKEY, toggletag, {.ui = 1 << TAG} }--#define CHVT(n) { MODCTRL|MODALT, XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} }--static const char *termcmd[] = { "foot", NULL };-static const char *menucmd[] = { "dmenu_run", NULL };--static const Key keys[] = {-	{ MODKEY, XKB_KEY_d, spawn, {.v = menucmd} },-	{ MODKEY, XKB_KEY_Return, spawn, {.v = termcmd} },-	{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },-	{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },-	{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },-	{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },-	{ MODKEY, XKB_KEY_o, incnmaster, {.i = -1} },-	{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },-	{ MODKEY, XKB_KEY_q, killclient, {0} },-	{ MODKEY|MODSHIFT, XKB_KEY_Tab, view, {0} },-	{ MODKEY|MODSHIFT, XKB_KEY_Return, zoom, {0} },-	{ MODKEY|MODSHIFT, XKB_KEY_T, setlayout, {.v = &layouts[0]} },-	{ MODKEY|MODSHIFT, XKB_KEY_F, setlayout, {.v = &layouts[1]} },-	{ MODKEY|MODSHIFT, XKB_KEY_M, setlayout, {.v = &layouts[2]} },-	{ MODKEY, XKB_KEY_space, togglefloating, {0} },-	{ MODKEY, XKB_KEY_f, togglefullscreen, {0} },-	{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },-	{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },-	{ MODKEY|MODSHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },-	{ MODKEY|MODSHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },-	{ MODKEY|MODSHIFT, XKB_KEY_P, quit, {0} },--	/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */-	{ MODCTRL|MODALT, XKB_KEY_Terminate_Server, quit, {0} },--	TAGKEYS(XKB_KEY_1, XKB_KEY_exclam, 0),-	TAGKEYS(XKB_KEY_2, XKB_KEY_at, 1),-	TAGKEYS(XKB_KEY_3, XKB_KEY_numbersign, 2),-	TAGKEYS(XKB_KEY_4, XKB_KEY_dollar, 3),-	TAGKEYS(XKB_KEY_5, XKB_KEY_percent, 4),-	TAGKEYS(XKB_KEY_6, XKB_KEY_asciicircum, 5),--	/* Ctrl-Alt-Fx is used to switch to another VT */-	CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),-	CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),-};--static const Button buttons[] = {-	{ MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} },-	{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },-	{ MODKEY, BTN_MIDDLE, togglefloating, {0} },-};