diff --git a/.gitignore b/.gitignore index 334079b..b987ef6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ mullvad/inactive result *.key *.pub_key -hosts/ +hosts/reflector diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index ec57d20..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "rhizome-vps"] - path = rhizome-vps - url = https://git.rhizome.tf/rhizome/server-config diff --git a/README.md b/README.md new file mode 100644 index 0000000..400e85b --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# a nixos config + +## mission statement + +this config attempts to follow the [synaptic standard](https://github.com/llakala/synaptic-standard/), and is built in an effort to achieve **semantic colocation**. + +ideally, our modules are categorised by the purpose they hope to fulfil, and contain all the information necessary to achieve that within their context. + +this is in contrast to many configuration styles which may be structured in a way that is beholden to mechanical details (ie. programs, interfaces, module systems they use). + +here, *we do not build our dreams of concrete*. + +## mechanism + +recursive imports and module aliasing bend the module system/s to our will. + +this allows us to create freeform sets of modules which realise broad purposes while cross-cutting module system concerns, all with a single toplevel import point. + +you can see [entry.nix](./entry.nix) and [util/create.nix](util/create.nix) for the explicit details of how this is done. diff --git a/TODO b/TODO deleted file mode 100644 index abc7c3a..0000000 --- a/TODO +++ /dev/null @@ -1,7 +0,0 @@ -REPLACE HOME MANAGER WITH -pkgs.writers and HJEM - -implement agenix - -figure out a way to get firefox policies and plugins set up in webapps - diff --git a/home/icons/fb_msg.png b/assets/fb_msg.png similarity index 100% rename from home/icons/fb_msg.png rename to assets/fb_msg.png diff --git a/home/icons/ms_teams.png b/assets/ms_teams.png similarity index 100% rename from home/icons/ms_teams.png rename to assets/ms_teams.png diff --git a/home/icons/ollama.png b/assets/ollama.png similarity index 100% rename from home/icons/ollama.png rename to assets/ollama.png diff --git a/home/icons/openwebui.png b/assets/openwebui.png similarity index 100% rename from home/icons/openwebui.png rename to assets/openwebui.png diff --git a/home/icons/winlogo.png b/assets/winlogo.png similarity index 100% rename from home/icons/winlogo.png rename to assets/winlogo.png diff --git a/common/cli.nix b/common/cli.nix new file mode 100644 index 0000000..68d1ef7 --- /dev/null +++ b/common/cli.nix @@ -0,0 +1,41 @@ +{ + pkgs, + userPkgs, + ... +}: +{ + environment.systemPackages = builtins.attrValues { + inherit (pkgs) + curl + eza + git + ; + }; + hm.home.packages = builtins.attrValues { + inherit (pkgs) + btop + bat + ripgrep + fd + lazygit + zoxide + zellij + ouch + ; + }; + programs.yazi = { + enable = true; + plugins = { + inherit (pkgs.yaziPlugins) + lazygit + chmod + diff + mediainfo + smart-enter + full-border + wl-clipboard + ; + fr = pkgs.callPackage userPkgs.fr-yazi { }; + }; + }; +} diff --git a/common/debloat.nix b/common/debloat.nix new file mode 100644 index 0000000..64e9788 --- /dev/null +++ b/common/debloat.nix @@ -0,0 +1,13 @@ +{ lib, ... }: +{ + + # misc perl + system.disableInstallerTools = true; + programs.less.lessopen = null; + programs.command-not-found.enable = false; + boot.enableContainers = false; + boot.loader.grub.enable = false; + environment.defaultPackages = lib.mkDefault [ ]; + documentation.info.enable = false; + system.tools.nixos-option.enable = false; +} diff --git a/system/modules/docs.nix b/common/docs.nix similarity index 100% rename from system/modules/docs.nix rename to common/docs.nix diff --git a/home/programs/helix.nix b/common/editor.nix similarity index 99% rename from home/programs/helix.nix rename to common/editor.nix index f6d1f3f..abd22ef 100644 --- a/home/programs/helix.nix +++ b/common/editor.nix @@ -1,14 +1,15 @@ { inputs, pkgs, - rice, + config, ... }: let + inherit (config) rice; pal = rice.palette.hex; in { - programs.helix = { + hm.programs.helix = { enable = true; package = inputs.helix.packages.${pkgs.system}.helix; themes = with pal; { diff --git a/common/network.nix b/common/network.nix new file mode 100644 index 0000000..9bdb40e --- /dev/null +++ b/common/network.nix @@ -0,0 +1,4 @@ +{ lib, ... }: +{ + networking.useDHCP = lib.mkDefault true; +} diff --git a/common/nix/gc.nix b/common/nix/gc.nix new file mode 100644 index 0000000..9d36665 --- /dev/null +++ b/common/nix/gc.nix @@ -0,0 +1,27 @@ +{ pkgs, inputs, ... }: +{ + imports = [ + inputs.angrr.nixosModules.angrr + ]; + + nix.gc = { + automatic = true; + dates = "weekly"; + persistent = true; + options = "--delete-older-than 14d"; + }; + + hm.nix.gc = { + automatic = true; + frequency = "weekly"; + options = "--delete-older-than 14d"; + }; + + services.angrr = { + enable = true; + enableNixGcIntegration = true; + period = "2weeks"; + package = inputs.angrr.packages.${pkgs.system}.default; + }; + +} diff --git a/common/nix/managers.nix b/common/nix/managers.nix new file mode 100644 index 0000000..2f692a0 --- /dev/null +++ b/common/nix/managers.nix @@ -0,0 +1,22 @@ +{ inputs, mainUser, ... }: +{ + imports = [ + inputs.meat.nixosModules.meat + ]; + programs.meat = { + enable = true; + flake = "/home/${mainUser}/.nix"; + }; + + # services.smooooth = { + # enable = true; + # path = "/home/${mainUser}/.nix"; + # blockers = [ + # "hx" + # { + # nix = "die"; + # } + # ]; + # nixPackage = pkgs.lix; + # }; +} diff --git a/common/nix/nixpkgs.nix b/common/nix/nixpkgs.nix new file mode 100644 index 0000000..a68d4ac --- /dev/null +++ b/common/nix/nixpkgs.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + nixpkgs = { + config = { + allowUnfree = true; + allowUnfreePredicate = _: true; + }; + }; +} diff --git a/common/nix/settings.nix b/common/nix/settings.nix new file mode 100644 index 0000000..a436d62 --- /dev/null +++ b/common/nix/settings.nix @@ -0,0 +1,26 @@ +{ inputs, ... }: +{ + imports = [ + inputs.lix-module.nixosModules.default + ]; + + nix = { + settings = { + experimental-features = [ + "nix-command" + "flakes" + "pipe-operator" + ]; + substitute = true; + }; + extraOptions = '' + keep-outputs = true + keep-derivations = true + ''; + optimise.automatic = true; + }; + + system.nixos.tags = [ "fatcock-xxl" ]; + + home-manager.useGlobalPkgs = true; +} diff --git a/system/substituters.nix b/common/nix/substituters.nix similarity index 100% rename from system/substituters.nix rename to common/nix/substituters.nix diff --git a/common/nix/tools.nix b/common/nix/tools.nix new file mode 100644 index 0000000..e809dce --- /dev/null +++ b/common/nix/tools.nix @@ -0,0 +1,21 @@ +{ pkgs, inputs, ... }: +{ + + environment.systemPackages = builtins.attrValues { + inherit (pkgs) + home-manager + cachix + nixfmt-rfc-style + ; + inherit (inputs.nil.packages.${pkgs.system}) nil; + }; + hm.imports = [ + inputs.nix-index-database.hmModules.nix-index + ]; + imports = [ + inputs.nix-index-database.nixosModules.nix-index + ]; + programs.nix-index-database.comma.enable = true; + programs.nix-index.enableZshIntegration = false; + programs.nix-index.enableBashIntegration = false; +} diff --git a/common/rice/default.nix b/common/rice/default.nix new file mode 100644 index 0000000..a6da9e6 --- /dev/null +++ b/common/rice/default.nix @@ -0,0 +1,55 @@ +{ + lib, + inputs, + ... +}: +let + nix-rice = import "${inputs.nix-rice}/lib.nix" { + inherit lib; + kitty-themes-src = { }; + }; + inherit (nix-rice) kitty-themes; + inherit (nix-rice.palette) toRGBShortHex toRGBHex; + theme = kitty-themes.parseTheme ./pal.conf; +in +{ + options.rice = lib.mkOption { + description = "ricing related variables"; + default = { }; + type = lib.types.attrsOf lib.types.anything; + }; + config.rice = rec { + palette = theme // { + normal = { + black = theme.color0; + red = theme.color1; + green = theme.color2; + yellow = theme.color3; + blue = theme.color4; + magenta = theme.color5; + cyan = theme.color6; + white = theme.color7; + }; + bright = { + black = theme.color8; + red = theme.color9; + green = theme.color10; + yellow = theme.color11; + blue = theme.color12; + magenta = theme.color13; + cyan = theme.color14; + white = theme.color15; + }; + util = { + fg = theme.foreground; + bg = theme.background; + fg_sel = theme.selection_foreground; + bg_sel = theme.selection_background; + inherit (theme) cursor; + # url = theme.url_color; + }; + hex = toRGBHex palette; + shortHex = toRGBShortHex palette; + }; + }; +} diff --git a/rice/header.sh b/common/rice/header.sh similarity index 100% rename from rice/header.sh rename to common/rice/header.sh diff --git a/rice/pal.conf b/common/rice/pal.conf similarity index 100% rename from rice/pal.conf rename to common/rice/pal.conf diff --git a/common/systemd.nix b/common/systemd.nix new file mode 100644 index 0000000..ab0327b --- /dev/null +++ b/common/systemd.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + systemd.services."user@".serviceConfig.Delegate = "memory pids cpu cpuset"; + systemd.user.extraConfig = "LogLevel=debug"; + hm.systemd.user.startServices = "sd-switch"; +} diff --git a/common/terminal.nix b/common/terminal.nix new file mode 100644 index 0000000..8df638b --- /dev/null +++ b/common/terminal.nix @@ -0,0 +1,56 @@ +{ + pkgs, + inputs, + ... +}: +let + inherit (pkgs) fish; +in +{ + imports = [ + inputs.culr.nixosModules.culr + ]; + programs.culr = { + enable = true; + pattern = "rainbow-split"; + }; + programs.fish = { + enable = true; + shellAbbrs = { + "gco" = "git checkout"; + "gcb" = "git checkout -b"; + "gp" = "git push"; + "gpf" = "git push --force"; + "gap" = "git commit -a --amend --no-edit && git push --force"; + "gl" = "git pull"; + "ga" = "git add"; + "gcam" = "git commit -am"; + }; + shellAliases = { + "l" = "eza -lg --icons=always --colour=always $argv | culr"; + "la" = "eza -lg --icons=always --colour=always $argv | culr"; + "p" = "ps $argv | culr"; + "mnt" = "mount | culr"; + }; + interactiveShellInit = '' + ${./rice/header.sh} + ''; + }; + programs.zoxide = { + enable = true; + enableFishIntegration = true; + }; + environment.systemPackages = [ + fish + ]; + environment.shells = [ fish ]; + users.defaultUserShell = fish; + console = { + font = "Lat2-Terminus16"; + }; + + environment.sessionVariables = { + EDITOR = "hx"; + }; + +} diff --git a/common/users.nix b/common/users.nix new file mode 100644 index 0000000..0514ece --- /dev/null +++ b/common/users.nix @@ -0,0 +1,16 @@ +{ lib, mainUser, ... }: +{ + services.userborn.enable = lib.mkDefault true; + nix.settings.trusted-users = [ mainUser ]; + users.users.${mainUser} = { + isNormalUser = true; + extraGroups = [ + "wheel" + ]; + }; + + hm.config.home = { + username = mainUser; + homeDirectory = "/home/${mainUser}"; + }; +} diff --git a/create.nix b/create.nix deleted file mode 100644 index ba939a8..0000000 --- a/create.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ - system, - inputs, - sharedModules, - ... -}: -with inputs; -let - nix-rice = import "${inputs.nix-rice}/lib.nix" { - inherit (nixpkgs) lib; - kitty-themes-src = { }; - }; - rice = import ./rice { - inherit - inputs - system - nix-rice - ; - }; -in -{ - systems = - definitions: - nixpkgs.lib.mapAttrs ( - name: info: - nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { - inherit inputs rice; - mainUser = info.user; - }; - modules = - [ - ./system/${name}.nix - home-manager.nixosModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - extraSpecialArgs = { - inherit inputs rice nix-rice; - mainUser = info.user; - }; - users.${info.user}.imports = [ - ./home/${info.user}.nix - ] ++ info.hmImports or [ ]; - }; - } - ] - ++ info.imports or [ ] - ++ sharedModules; - } - ) definitions; -} diff --git a/entry.nix b/entry.nix index dd060a2..e1b309b 100644 --- a/entry.nix +++ b/entry.nix @@ -1,33 +1,23 @@ let - inputs = import ./inputs.nix; - modules = import ./util/get-modules.nix inputs; - create = import ./create.nix { - system = "x86_64-linux"; - inherit inputs; - sharedModules = - with inputs; - (modules [ - culr - meat - niri - niri-tag - lix-module - angrr - arbys - # smooooth - ]) - ++ [ - nix-index-database.nixosModules.nix-index - ./system/substituters.nix - ]; - }; + create = import ./util/create.nix; in { nixosConfigurations = create.systems { quiver = { user = "bolt"; - imports = with inputs; (modules [ nyx ]); + imports = [ + ./common + ./graphical + ./hosts/quiver + ]; + }; + adrift = { + user = "plank"; + imports = [ + ./common + ./graphical + ./hosts/adrift + ]; }; - adrift.user = "plank"; }; } diff --git a/flake.lock b/flake.lock index bd67350..fc5440d 100644 --- a/flake.lock +++ b/flake.lock @@ -40,14 +40,17 @@ }, "arbys": { "locked": { - "lastModified": 1752908944, - "narHash": "sha256-bx+zNhM2rxt55qnlgWfOq97JzxwzWzvynKP5h9uJoZk=", - "path": "/home/bolt/code/arbys", - "type": "path" + "lastModified": 1753022411, + "narHash": "sha256-m4pEYNwUZh64FyRIM1TSmRn1n4A85WEzVu5Gk2VHvAY=", + "ref": "refs/heads/meats", + "rev": "e7fa12d6f3f5b723bce413acdfa5461fbaa3ec97", + "revCount": 1, + "type": "git", + "url": "https://git.atagen.co/atagen/arbys" }, "original": { - "path": "/home/bolt/code/arbys", - "type": "path" + "type": "git", + "url": "https://git.atagen.co/atagen/arbys" } }, "crane": { @@ -459,11 +462,11 @@ "unf": "unf" }, "locked": { - "lastModified": 1752153625, - "narHash": "sha256-N4N0z0I9rtVgAPnPeHBMB46MongPCUTpZdYxOtt2dVY=", + "lastModified": 1753059450, + "narHash": "sha256-WsGRRQGNnPu0Bv5QPhbnouAWjdsmCuE9VzgZN7U+EQY=", "ref": "refs/heads/master", - "rev": "51d501a68e2f6c11460733bffb590056edbfec11", - "revCount": 36, + "rev": "de951b227223ee924c37c7aa282bade34686bf83", + "revCount": 38, "type": "git", "url": "https://git.atagen.co/atagen/meat" }, @@ -1041,11 +1044,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1751949589, - "narHash": "sha256-mgFxAPLWw0Kq+C8P3dRrZrOYEQXOtKuYVlo9xvPntt8=", + "lastModified": 1748217807, + "narHash": "sha256-P3u2PXxMlo49PutQLnk2PhI/imC69hFl1yY4aT5Nax8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9b008d60392981ad674e04016d25619281550a9d", + "rev": "3108eaa516ae22c2360928589731a4f1581526ef", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a8caf69..260ae0c 100644 --- a/flake.nix +++ b/flake.nix @@ -2,42 +2,6 @@ description = "nixos config"; outputs = _: { }; - # outputs = - # inputs: - # with inputs; - # let - # modules = import ./util/get-modules.nix { - # inherit inputs; - # }; - # create = import ./create.nix { - # inherit inputs; - # system = "x86_64-linux"; - # sharedModules = - # (modules [ - # culr - # meat - # niri - # niri-tag - # lix-module - # angrr - # arbys - # # smooooth - # ]) - # ++ [ - # nix-index-database.nixosModules.nix-index - # ./system/substituters.nix - # ]; - # }; - # in - # { - # nixosConfigurations = create.systems { - # quiver = { - # user = "bolt"; - # imports = (modules [ nyx ]); - # }; - # adrift.user = "plank"; - # }; - # }; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; @@ -71,16 +35,6 @@ culr.url = "git+https://git.atagen.co/atagen/culr"; - # comfyui = { - # url = "path:./flakes/comfyui"; - # inputs.nixpkgs.follows = "nixpkgs"; - # }; - - # comfyui-plugins = { - # url = "path:./flakes/comfyui-plugins"; - # inputs.nixpkgs.follows = "nixpkgs"; - # }; - niri.url = "github:sodiboo/niri-flake"; hjem = { @@ -103,7 +57,7 @@ angrr.url = "github:linyinfeng/angrr"; - arbys.url = "path:/home/bolt/code/arbys"; + arbys.url = "git+https://git.atagen.co/atagen/arbys"; __flake-compat = { url = "git+https://git.lix.systems/lix-project/flake-compat.git"; diff --git a/flakes/comfyui-plugins/essentials/default.nix b/flakes/comfyui-plugins/essentials/default.nix deleted file mode 100644 index e8b24ca..0000000 --- a/flakes/comfyui-plugins/essentials/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - pkgs, - src, - python3Packages, - ... -}: -let - inherit (python3Packages) - numba - colour-science - rembg - pixeloe - transparent-background - ; -in -pkgs.stdenvNoCC.mkDerivation { - pname = "comfyui-essentials"; - version = "dev-${builtins.toString src.lastModified}"; - inherit src; - - propagatedBuildInputs = [ - numba - colour-science - rembg - pixeloe - transparent-background - ]; -} diff --git a/flakes/comfyui-plugins/flake.lock b/flakes/comfyui-plugins/flake.lock deleted file mode 100644 index ed0ef70..0000000 --- a/flakes/comfyui-plugins/flake.lock +++ /dev/null @@ -1,75 +0,0 @@ -{ - "nodes": { - "gguf": { - "flake": false, - "locked": { - "lastModified": 1736350217, - "narHash": "sha256-3RqFfvXdn9sCIlctqa14c2fvluSmJCR+llfZo/MV64o=", - "owner": "city96", - "repo": "ComfyUI-GGUF", - "rev": "5875c52f59baca3a9372d68c43a3775e21846fe0", - "type": "github" - }, - "original": { - "owner": "city96", - "repo": "ComfyUI-GGUF", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1738410390, - "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", - "path": "/nix/store/hjb1rqv2mfs5ny47amj2gsc8xk05x5g6-source", - "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", - "type": "path" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "openpose": { - "flake": false, - "locked": { - "lastModified": 1685841563, - "narHash": "sha256-GUjs8mIUFAbjJEVL+EsT44HG42mAiumKOBlBas1xxrM=", - "owner": "space-nuko", - "repo": "ComfyUI-OpenPose-Editor", - "rev": "4d8fe730acdb11ab2fcd592129d91d338d270adf", - "type": "github" - }, - "original": { - "owner": "space-nuko", - "repo": "ComfyUI-OpenPose-Editor", - "type": "github" - } - }, - "root": { - "inputs": { - "gguf": "gguf", - "nixpkgs": "nixpkgs", - "openpose": "openpose", - "tensorrt": "tensorrt" - } - }, - "tensorrt": { - "flake": false, - "locked": { - "lastModified": 1728519788, - "narHash": "sha256-tqiodF60IVlmvJknYxEwL0U7GIrrfl49k6Tg+8jGRVU=", - "owner": "comfyanonymous", - "repo": "ComfyUI_TensorRT", - "rev": "5bcc3f1e5c2424bb20bcb586e340c25ebe4a954f", - "type": "github" - }, - "original": { - "owner": "comfyanonymous", - "repo": "ComfyUI_TensorRT", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flakes/comfyui-plugins/flake.nix b/flakes/comfyui-plugins/flake.nix deleted file mode 100644 index 14c93b8..0000000 --- a/flakes/comfyui-plugins/flake.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ - inputs = { - gguf = { - url = "github:city96/ComfyUI-GGUF"; - flake = false; - }; - - tensorrt = { - url = "github:comfyanonymous/ComfyUI_TensorRT"; - flake = false; - }; - - # needs some deps packaged - # essentials = { - # url = "github:cubiq/ComfyUI_essentials"; - # flake = false; - # }; - - openpose = { - url = "github:space-nuko/ComfyUI-OpenPose-Editor"; - flake = false; - }; - }; - - outputs = - { - self, - nixpkgs, - ... - }: - let - pkgs = import nixpkgs { - system = "x86_64-linux"; - }; - inherit (pkgs) lib callPackage; - inherit (builtins) mapAttrs; - filteredInputs = lib.filterAttrs (n: _v: n != "nixpkgs") self.inputs; - in - { - overlays.comfyui-plugins = final: _prev: { - comfyui-plugins = mapAttrs ( - name: value: final.callPackage ./${name}/default.nix { src = value; } - ) filteredInputs; - }; - packages.x86_64-linux = mapAttrs ( - name: value: callPackage ./${name}/default.nix { src = value; } - ) filteredInputs; - }; -} diff --git a/flakes/comfyui-plugins/gguf/default.nix b/flakes/comfyui-plugins/gguf/default.nix deleted file mode 100644 index 0d116c7..0000000 --- a/flakes/comfyui-plugins/gguf/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - pkgs, - src, - python3Packages, - ... -}: -let - inherit (python3Packages) gguf numpy pyyaml; -in -pkgs.stdenvNoCC.mkDerivation { - pname = "comfyui-gguf"; - version = "dev-${builtins.toString src.lastModified}"; - inherit src; - propagatedBuildInputs = [ - gguf - numpy - pyyaml - ]; - installPhase = '' - mkdir -p $out - cp -r * $out/ - ''; -} diff --git a/flakes/comfyui-plugins/openpose/default.nix b/flakes/comfyui-plugins/openpose/default.nix deleted file mode 100644 index 9adf02c..0000000 --- a/flakes/comfyui-plugins/openpose/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - pkgs, - src, - ... -}: -pkgs.stdenvNoCC.mkDerivation { - pname = "comfyui-openpose-editor"; - version = "dev-${builtins.toString src.lastModified}"; - inherit src; - - patches = [ - ./openpose_no_update.patch - ]; - - installPhase = '' - mkdir -p $out - cp -r * $out/ - cp js/* $out/ - ''; -} diff --git a/flakes/comfyui-plugins/openpose/openpose_no_update.patch b/flakes/comfyui-plugins/openpose/openpose_no_update.patch deleted file mode 100644 index 2f440de..0000000 --- a/flakes/comfyui-plugins/openpose/openpose_no_update.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/__init__.py b/__init__.py -index e4cf8bb..7d8f894 100644 ---- a/__init__.py -+++ b/__init__.py -@@ -35,6 +35,6 @@ def update_javascript(): - shutil.copy(src_file, dst_file) - - --update_javascript() -+# update_javascript() - - print('\033[34mOpenPose Editor: \033[92mLoaded\033[0m') diff --git a/flakes/comfyui-plugins/tensorrt/default.nix b/flakes/comfyui-plugins/tensorrt/default.nix deleted file mode 100644 index 383a2ac..0000000 --- a/flakes/comfyui-plugins/tensorrt/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - pkgs, - src, - python3Packages, - ... -}: -let - inherit (python3Packages) tensorrt onnx; -in -pkgs.stdenvNoCC.mkDerivation { - pname = "comfyui-tensorrt"; - version = "dev-${builtins.toString src.lastModified}"; - inherit src; - - propagatedBuildInputs = [ - tensorrt - onnx - ]; - - installPhase = '' - mkdir -p $out - cp -r * $out - ''; -} diff --git a/flakes/comfyui/default.nix b/flakes/comfyui/default.nix deleted file mode 100644 index 1d4fb7f..0000000 --- a/flakes/comfyui/default.nix +++ /dev/null @@ -1,96 +0,0 @@ -{ - pkgs, - lib, - config, - comfyui, - comfy_dir ? "/run/user/1000/comfyui/", - spandrel, - plugins ? config.comfyui.plugins or [ ], - ... -}: -let - inherit (pkgs) python3; - inherit (pkgs.python3Packages) - torch - torchsde - torchvision - torchaudio - einops - transformers - tokenizers - sentencepiece - safetensors - aiohttp - pyyaml - pillow - scipy - tqdm - psutil - kornia - soundfile - ; - - python = python3.buildEnv.override { - extraLibs = [ - torch - torchsde - torchvision - torchaudio - einops - transformers - tokenizers - sentencepiece - safetensors - aiohttp - pyyaml - pillow - scipy - tqdm - psutil - kornia - soundfile - - spandrel - ] ++ plugins; - }; -in -pkgs.stdenvNoCC.mkDerivation { - name = "comfyui"; - pname = "comfyui"; - version = "dev-${builtins.toString comfyui.lastModified}"; - src = comfyui; - nativeBuildInputs = - let - inherit (pkgs) makeWrapper; - in - [ - makeWrapper - ]; - propagatedBuildInputs = - let - inherit (pkgs.cudaPackages) cudatoolkit; - in - [ - python - cudatoolkit - ]; - - patches = [ ./folder_paths.patch ]; - - installPhase = - let - launcher = pkgs.writeShellScript "launch.sh" '' - mkdir -p $COMFY_DIR/custom_nodes - mkdir -p $COMFY_DIR/models/{checkpoints,configs,loras,vae,clip,unet,diffusion_models,clip_vision,style_models,embeddings,diffusers,vae_approx,controlnet,gligen,upscale_models,hypernetworks,photomaker,classifiers} - ${python}/bin/python3 $COMFY/comfyui/main.py --output-directory $(mktemp) - ''; - in - '' - mkdir -p $out/comfyui - cp -r * $out/comfyui - mkdir -p $out/bin - makeWrapper ${launcher} $out/bin/comfyui --prefix PATH : ${lib.makeBinPath [ python ]} \ - --set PYTHONPATH ${lib.makeLibraryPath [ python ]} --set COMFY $out --set COMFY_DIR ${comfy_dir} - ''; - meta.mainProgram = "comfyui"; -} diff --git a/flakes/comfyui/flake.lock b/flakes/comfyui/flake.lock deleted file mode 100644 index 805bbb0..0000000 --- a/flakes/comfyui/flake.lock +++ /dev/null @@ -1,41 +0,0 @@ -{ - "nodes": { - "comfyui": { - "flake": false, - "locked": { - "lastModified": 1739165060, - "narHash": "sha256-DLiv96ynd+p4lXgvNMqgSklWFciLX+l+nXlu5MYVrg8=", - "owner": "comfyanonymous", - "repo": "ComfyUI", - "rev": "4027466c802d174d76347726d74de73c39acedb3", - "type": "github" - }, - "original": { - "owner": "comfyanonymous", - "repo": "ComfyUI", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1738410390, - "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", - "path": "/nix/store/hjb1rqv2mfs5ny47amj2gsc8xk05x5g6-source", - "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", - "type": "path" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "root": { - "inputs": { - "comfyui": "comfyui", - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flakes/comfyui/flake.nix b/flakes/comfyui/flake.nix deleted file mode 100644 index 58b690f..0000000 --- a/flakes/comfyui/flake.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ - inputs = { - comfyui = { - url = "github:comfyanonymous/ComfyUI"; - flake = false; - }; - }; - - nixConfig = { - extra-substituters = [ - "https://nix-community.cachix.org" - "https://cuda-maintainers.cachix.org" - ]; - extra-trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" - ]; - }; - - outputs = - { - self, - nixpkgs, - comfyui, - }: - { - homeManagerModules.comfyui = import ./module.nix; - - overlays.comfyui = final: _prev: { - comfyui = - let - spandrel = final.callPackage ./spandrel.nix { }; - in - final.callPackage ./default.nix { - cudaSupport = true; - inherit comfyui spandrel; - }; - }; - - packages.x86_64-linux = - let - system = "x86_64-linux"; - pkgs = import nixpkgs { - config.allowUnfree = true; - config.cudaSupport = true; - inherit system; - }; - spandrel = pkgs.callPackage ./spandrel.nix { }; - in - { - default = pkgs.callPackage ./default.nix { - inherit comfyui spandrel; - }; - }; - }; -} diff --git a/flakes/comfyui/folder_paths.patch b/flakes/comfyui/folder_paths.patch deleted file mode 100644 index 457a571..0000000 --- a/flakes/comfyui/folder_paths.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/folder_paths.py b/folder_paths.py -index 01ae821..27906ac 100644 ---- a/folder_paths.py -+++ b/folder_paths.py -@@ -11,7 +11,7 @@ supported_pt_extensions: set[str] = {'.ckpt', '.pt', '.bin', '.pth', '.safetenso - - folder_names_and_paths: dict[str, tuple[list[str], set[str]]] = {} - --base_path = os.path.dirname(os.path.realpath(__file__)) -+base_path = os.path.dirname(os.environ['COMFY_DIR']) - models_dir = os.path.join(base_path, "models") - folder_names_and_paths["checkpoints"] = ([os.path.join(models_dir, "checkpoints")], supported_pt_extensions) - folder_names_and_paths["configs"] = ([os.path.join(models_dir, "configs")], [".yaml"]) -@@ -39,10 +39,10 @@ folder_names_and_paths["photomaker"] = ([os.path.join(models_dir, "photomaker")] - - folder_names_and_paths["classifiers"] = ([os.path.join(models_dir, "classifiers")], {""}) - --output_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "output") --temp_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "temp") --input_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "input") --user_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), "user") -+output_directory = os.path.join(base_path, "output") -+temp_directory = os.path.join(base_path, "temp") -+input_directory = os.path.join(base_path, "input") -+user_directory = os.path.join(base_path, "user") - - filename_list_cache: dict[str, tuple[list[str], dict[str, float], float]] = {} - diff --git a/flakes/comfyui/module.nix b/flakes/comfyui/module.nix deleted file mode 100644 index 1c6f715..0000000 --- a/flakes/comfyui/module.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: -let - inherit (lib) - mkEnableOption - mkOption - types - hasSuffix - ; - cfg = config.programs.comfyui; - # comfyui only understands the path properly with a trailing slash - getStorage = if (hasSuffix "/" cfg.storage) then cfg.storage else cfg.storage + "/"; -in -{ - options.programs.comfyui = { - enable = mkEnableOption "ComfyUI"; - storage = mkOption { - type = types.path; - description = "where to source models and store information"; - }; - plugins = mkOption { - type = with types; listOf package; - description = "list of comfyui plugins"; - default = [ ]; - }; - }; - config = lib.mkIf cfg.enable { - home.packages = [ - # pkgs.comfyui - (pkgs.comfyui.override { - comfy_dir = getStorage; - inherit (cfg) plugins; - }) - ]; - home.file = builtins.listToAttrs ( - map (pkg: { - name = "${getStorage}/custom_nodes/${pkg.name}"; - value = { - recursive = true; - source = "${pkg}"; - }; - }) cfg.plugins - ); - }; -} diff --git a/flakes/comfyui/spandrel.nix b/flakes/comfyui/spandrel.nix deleted file mode 100644 index 7c7d740..0000000 --- a/flakes/comfyui/spandrel.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - python3Packages, - fetchPypi, - ... -}: -python3Packages.buildPythonPackage rec { - pname = "spandrel"; - version = "0.4.0"; - pyproject = true; - - src = fetchPypi { - inherit pname version; - hash = "sha256-9FUmiT+SOhLvN1QsROREsSCJdlk7x8zfpU/QTHw+gMo="; - }; - - build-system = - let - inherit (python3Packages) setuptools; - in - [ - setuptools - ]; - - dependencies = - let - inherit (python3Packages) - torch - torchvision - safetensors - numpy - einops - typing-extensions - ; - in - [ - torch - torchvision - safetensors - numpy - einops - typing-extensions - ]; - - doCheck = false; -} diff --git a/flakes/niri-session-manager/flake.lock b/flakes/niri-session-manager/flake.lock deleted file mode 100644 index b5285a9..0000000 --- a/flakes/niri-session-manager/flake.lock +++ /dev/null @@ -1,41 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1749285348, - "narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=", - "path": "/nix/store/syvnmj3hhckkbncm94kfkbl76qsdqqj3-source", - "rev": "3e3afe5174c561dee0df6f2c2b2236990146329f", - "type": "path" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs", - "src": "src" - } - }, - "src": { - "flake": false, - "locked": { - "lastModified": 1741050520, - "narHash": "sha256-bTOxv5yZh6wgCs7ADUFKdlXGtlIckkSijGV8G7ToVy4=", - "owner": "MTeaHead", - "repo": "niri-session-manager", - "rev": "e8732380991bd629a7e6c3fb5ea50317084fb1eb", - "type": "github" - }, - "original": { - "owner": "MTeaHead", - "repo": "niri-session-manager", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flakes/niri-session-manager/flake.nix b/flakes/niri-session-manager/flake.nix deleted file mode 100644 index ee1cd01..0000000 --- a/flakes/niri-session-manager/flake.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ - inputs = { - src = { - url = "github:MTeaHead/niri-session-manager"; - flake = false; - }; - }; - - outputs = - { - nixpkgs, - src, - self, - }: - { - packages.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.rustPlatform.callPackage ( - { pkgs, buildRustPackage }: - buildRustPackage (finalAttrs: { - pname = "niri-session-manager"; - version = "git-${src.rev or src.dirtyRev or "dirty"}"; - inherit src; - - cargoLock = { - lockFile = "${src}/Cargo.lock"; - }; - - meta.mainProgram = "niri-session-manager"; - }) - ) { }; - - nixosModules.niri-session-manager = - { - config, - lib, - pkgs, - ... - }: - { - options = { - services.niri-session-manager = { - enable = lib.mkEnableOption "Niri Session Manager"; - }; - }; - config = - let - cfg = config.services.niri-session-manager; - in - lib.mkIf cfg.enable { - systemd.user.services.niri-session-manager = { - enable = true; - description = "Niri Session Manager"; - wantedBy = [ "graphical-session.target" ]; - partOf = [ "graphical-session.target" ]; - wants = [ "graphical-session.target" ]; - after = [ "graphical-session.target" ]; - serviceConfig = { - Type = "simple"; - Restart = "always"; - ExecStart = "${self.packages.${pkgs.system}.default}"; - PrivateTmp = true; - }; - }; - }; - }; - }; -} diff --git a/graphical/audio-control.nix b/graphical/audio-control.nix new file mode 100644 index 0000000..57a2e8c --- /dev/null +++ b/graphical/audio-control.nix @@ -0,0 +1,15 @@ +{ + pkgs, + lib, + ... +}: +{ + hm.home.packages = builtins.attrValues { + inherit (pkgs) + avizo + playerctl + ; + }; + + hm.quickServices."avizo-service" = "${lib.getExe' pkgs.avizo "avizo-service"}"; +} diff --git a/graphical/binds.nix b/graphical/binds.nix new file mode 100644 index 0000000..7a2bcc0 --- /dev/null +++ b/graphical/binds.nix @@ -0,0 +1,119 @@ +{ + pkgs, + lib, + config, + inputs, + ... +}: +let + inherit (lib) + range + nameValuePair + mapAttrs' + mergeAttrsList + ; + inherit (builtins) listToAttrs replaceStrings; + inherit (config.hm.lib.niri) actions; + hBinds = { + H = "left"; + L = "right"; + }; + vBinds = { + J = "down"; + K = "up"; + }; + makeDirBind = + mods: cmd: keys: + mapAttrs' ( + key: dir: + nameValuePair "${mods}+${key}" { + action = actions."${replaceStrings [ "$DIR" ] [ "${dir}" ] "${cmd}"}"; + } + ) keys; + makeWsBind = + mods: cmd: + listToAttrs ( + map (num: { + name = "${mods}+${builtins.toString num}"; + value = { + action."${cmd}" = num; + }; + }) (range 1 6) + ); + tagctl = lib.getExe' inputs.niri-tag.packages.${pkgs.system}.unstable "tagctl"; + makeTagBind = + mods: cmd: + listToAttrs ( + map (num: { + name = "${mods}+${builtins.toString num}"; + value = { + action.spawn = [ + tagctl + cmd + (builtins.toString num) + ]; + }; + }) (range 1 6) + ); +in +{ + hm.programs.niri.settings.binds = mergeAttrsList [ + { + "Mod+D".action.spawn = [ + "qs" + "ipc" + "call" + "launch" + "toggle" + ]; + "Mod+F".action.spawn = "firefox"; + "Mod+E".action.spawn = "nautilus"; + "Mod+Return".action.spawn = "kitty"; + "Mod+Shift+E".action.spawn = "wlogout"; + "Mod+Equal".action.spawn = "bitwarden"; + "Mod+Shift+Q".action = actions.close-window; + "Mod+Shift+S".action = actions.screenshot; + "Mod+R".action = actions.switch-preset-column-width; + "Mod+Shift+R".action = actions.maximize-column; + "XF86AudioRaiseVolume".action.spawn = [ + "volumectl" + "-u" + "up" + ]; + "XF86AudioLowerVolume".action.spawn = [ + "volumectl" + "-u" + "down" + ]; + "XF86AudioMute".action.spawn = [ + "volumectl" + "toggle-mute" + ]; + "XF86AudioStop".action.spawn = [ + "playerctl" + "stop" + ]; + "XF86AudioPlay".action.spawn = [ + "playerctl" + "play-pause" + ]; + "XF86AudioNext".action.spawn = [ + "playerctl" + "next" + ]; + "XF86AudioPrev".action.spawn = [ + "playerctl" + "previous" + ]; + "Mod+Space".action = actions.toggle-window-floating; + } + (makeDirBind "Mod" "focus-window-$DIR" vBinds) + (makeDirBind "Mod" "focus-column-or-monitor-$DIR" hBinds) + (makeDirBind "Mod+Shift" "move-column-$DIR-or-to-monitor-$DIR" hBinds) + (makeDirBind "Mod+Ctrl" "consume-or-expel-window-$DIR" hBinds) + (makeDirBind "Mod+Ctrl" "move-window-$DIR" vBinds) + (makeTagBind "Mod" "toggle-tag") + (makeTagBind "Mod+Shift" "toggle") + (makeTagBind "Mod+Ctrl" "exclusive-tag") + ]; +} diff --git a/system/modules/bootloader.nix b/graphical/boot.nix similarity index 85% rename from system/modules/bootloader.nix rename to graphical/boot.nix index 3bbf4f3..2554788 100644 --- a/system/modules/bootloader.nix +++ b/graphical/boot.nix @@ -1,8 +1,12 @@ +{ config, ... }: +let + inherit (config) rice; +in { - rice, - ... -}: -{ + boot.tmp.useTmpfs = true; + + boot.initrd.systemd.enable = true; + boot.loader.limine = { enable = true; style = @@ -32,10 +36,5 @@ backdrop = pal.util.bg; }; maxGenerations = 5; - extraEntries = '' - /Windows - protocol: efi - path: boot():/EFI/Microsoft/Boot/bootmgfw.efi - ''; }; } diff --git a/home/programs/firefox.nix b/graphical/browser.nix similarity index 99% rename from home/programs/firefox.nix rename to graphical/browser.nix index cfbdf61..124cc95 100644 --- a/home/programs/firefox.nix +++ b/graphical/browser.nix @@ -21,7 +21,7 @@ let }; in { - programs.firefox = { + hm.programs.firefox = { enable = true; policies = { diff --git a/graphical/chat.nix b/graphical/chat.nix new file mode 100644 index 0000000..60663ca --- /dev/null +++ b/graphical/chat.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: +{ + hm.programs.firefox.webapps = { + "Microsoft-Teams" = { + url = "https://teams.microsoft.com"; + extraSettings = config.hm.programs.firefox.profiles.default.settings; + name = "Microsoft Teams"; + icon = ../assets/ms_teams.png; + }; + "Facebook-Messenger" = { + url = "https://www.messenger.com"; + extraSettings = config.hm.programs.firefox.profiles.default.settings; + name = "Facebook Messenger"; + icon = ../assets/fb_msg.png; + }; + }; + hm.home.packages = [ pkgs.cinny-desktop ]; +} diff --git a/home/modules/dev.nix b/graphical/dev.nix similarity index 61% rename from home/modules/dev.nix rename to graphical/dev.nix index 6b2aad8..63721f6 100644 --- a/home/modules/dev.nix +++ b/graphical/dev.nix @@ -1,18 +1,13 @@ { pkgs, - lib, - rice, ... }: let getPkgs = builtins.attrValues; in { - # imports = [ - # ../programs/vscode.nix - # ]; - home.packages = + hm.home.packages = getPkgs { inherit (pkgs) direnv @@ -65,48 +60,7 @@ in }) ]; - programs.zed-editor = { - enable = false; - extensions = [ - "nix" - "rust" - "ocaml" - "kanagawa-themes" - ]; - userSettings = { - features = { - copilot = false; - }; - buffer_font_family = rice.fonts.monospace.name; - buffer_font_size = rice.fonts.monospace.size; - theme = { - mode = "dark"; - dark = "Kanagawa Dragon"; - }; - telemetry = { - metrics = false; - diagnostics = false; - }; - vim_mode = true; - assistant = { - default_model = { - provider = "ollama"; - model = "llama3.2"; - }; - inline_alternatives = { - provider = "ollama"; - model = "starcoder2:3b"; - }; - }; - language_models = { - ollama = { - api_url = "http://localhost:11434"; - }; - }; - }; - }; - - programs.direnv = { + hm.programs.direnv = { enable = true; nix-direnv = { enable = true; @@ -114,13 +68,10 @@ in enableFishIntegration = true; }; - programs.git = { + hm.programs.git = { enable = true; userName = "atagen"; userEmail = "boss@atagen.co"; - extraConfig = { - credential.helper = "rbw"; - }; }; } diff --git a/graphical/documents.nix b/graphical/documents.nix new file mode 100644 index 0000000..18aca39 --- /dev/null +++ b/graphical/documents.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + hm.home.packages = builtins.attrValues { + inherit (pkgs) + libreoffice + thunderbird + obsidian + ; + }; +} diff --git a/graphical/fm.nix b/graphical/fm.nix new file mode 100644 index 0000000..e93af84 --- /dev/null +++ b/graphical/fm.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + hm.home.packages = builtins.attrValues { + inherit (pkgs) + file-roller + nautilus + ; + }; + +} diff --git a/graphical/gfx-env.nix b/graphical/gfx-env.nix new file mode 100644 index 0000000..ac514a0 --- /dev/null +++ b/graphical/gfx-env.nix @@ -0,0 +1,14 @@ +{ + ... +}: +{ + environment.sessionVariables = { + NIXOS_OZONE_WL = "1"; + GBM_BACKEND = "nvidia-drm"; + NVD_BACKEND = "direct"; + __GLX_VENDOR_LIBRARY_NAME = "nvidia"; + LIBVA_DRIVER_NAME = "nvidia"; + __GL_GSYNC_ALLOWED = "1"; + __GL_VRR_ALLOWED = "1"; + }; +} diff --git a/graphical/hw.nix b/graphical/hw.nix new file mode 100644 index 0000000..46cc98f --- /dev/null +++ b/graphical/hw.nix @@ -0,0 +1,5 @@ +{ ... }: +{ + hardware.enableRedistributableFirmware = true; + hardware.enableAllFirmware = true; +} diff --git a/graphical/input.nix b/graphical/input.nix new file mode 100644 index 0000000..7db5e0d --- /dev/null +++ b/graphical/input.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + services.libinput.enable = true; + console.useXkbConfig = true; + services.xserver.xkb.options = "caps:swapescape"; +} diff --git a/graphical/integrations.nix b/graphical/integrations.nix new file mode 100644 index 0000000..7697022 --- /dev/null +++ b/graphical/integrations.nix @@ -0,0 +1,38 @@ +{ + pkgs, + ... +}: +{ + xdg.autostart.enable = true; + xdg.portal.enable = true; + + hm.xdg = { + enable = true; + portal = + let + gtk = pkgs.xdg-desktop-portal-gtk; + gnome = pkgs.xdg-desktop-portal-gnome; + in + { + enable = true; + config = { + common = { + default = [ + "gnome" + ]; + }; + }; + extraPortals = [ + gnome + gtk + ]; + }; + }; + + environment.pathsToLink = [ + "/share/xdg-desktop-portal" + "/share/applications" + ]; + + security.polkit.enable = true; +} diff --git a/graphical/kernel.nix b/graphical/kernel.nix new file mode 100644 index 0000000..41c8ac2 --- /dev/null +++ b/graphical/kernel.nix @@ -0,0 +1,11 @@ +{ pkgs, inputs, ... }: +{ + imports = [ + inputs.nyx.nixosModules.default + ]; + services.scx = { + enable = true; + scheduler = "scx_bpfland"; + }; + boot.kernelPackages = pkgs.linuxPackages_cachyos; +} diff --git a/graphical/logout.nix b/graphical/logout.nix new file mode 100644 index 0000000..9d82548 --- /dev/null +++ b/graphical/logout.nix @@ -0,0 +1,45 @@ +{ + pkgs, + config, + ... +}: +let + inherit (config) rice; + pal = rice.palette.hex; +in +{ + hm.programs.wlogout = { + enable = true; + package = pkgs.wleave; + layout = builtins.fromJSON (builtins.readFile ./logout/layout); + style = + with pal; + (builtins.replaceStrings + [ + "/usr/share/wlogout" + "/etc/wlogout" + "#WINBG" + "#BTNCOL" + "#BTNBG" + "#BTNFOCUSBG" + "#WINLOGO" + ] + [ + "${pkgs.wlogout}/share/wlogout" + "${pkgs.wlogout}/etc/wlogout" + util.bg + bright.yellow + util.bg + normal.black + (builtins.path { + name = "winlogo"; + path = ../assets/winlogo.png; + sha256 = "7c1ff96b553c7a7ca3a7b7cf8efe830ab7feea92355aed288a10ee7347c24108"; + }) + ] + (builtins.readFile ./logout/style.css) + ); + }; + + hm.home.packages = [ pkgs.wleave ]; +} diff --git a/home/dots/wlogout/layout b/graphical/logout/layout similarity index 100% rename from home/dots/wlogout/layout rename to graphical/logout/layout diff --git a/graphical/logout/style.css b/graphical/logout/style.css new file mode 100644 index 0000000..4689381 --- /dev/null +++ b/graphical/logout/style.css @@ -0,0 +1,48 @@ +* { + background-image: none; +} +window { + background-color: #WINBG; +} +button { + color: #BTNCOL; + background-color: #BTNBG; + border-style: solid; + border-width: 2px; + background-repeat: no-repeat; + background-position: center; + background-size: 25%; +} + +button:focus, button:active, button:hover { + background-color: #BTNFOCUSBG; + outline-style: none; +} + +#lock { + background-image: image(url("/usr/share/wlogout/assets/lock.png"), url("/usr/local/share/wlogout/assets/lock.png")); +} + +#logout { + background-image: image(url("/usr/share/wlogout/assets/logout.png"), url("/usr/local/share/wlogout/assets/logout.png")); +} + +#suspend { + background-image: image(url("/usr/share/wlogout/assets/suspend.png"), url("/usr/local/share/wlogout/assets/suspend.png")); +} + +#hibernate { + background-image: image(url("/usr/share/wlogout/assets/hibernate.png"), url("/usr/local/share/wlogout/assets/hibernate.png")); +} + +#shutdown { + background-image: image(url("/usr/share/wlogout/assets/shutdown.png"), url("/usr/local/share/wlogout/assets/shutdown.png")); +} + +#reboot { + background-image: image(url("/usr/share/wlogout/assets/reboot.png"), url("/usr/local/share/wlogout/assets/reboot.png")); +} + +#windows { + background-image: image(url("#WINLOGO")) +} diff --git a/home/modules/media-players.nix b/graphical/media.nix similarity index 70% rename from home/modules/media-players.nix rename to graphical/media.nix index 87270a5..8cc11f8 100644 --- a/home/modules/media-players.nix +++ b/graphical/media.nix @@ -1,12 +1,11 @@ { pkgs, ... }: { - home.packages = builtins.attrValues { + hm.home.packages = builtins.attrValues { inherit (pkgs) mpv imv resonance zathura - playerctl feishin nicotine-plus ; diff --git a/graphical/network.nix b/graphical/network.nix new file mode 100644 index 0000000..20d18de --- /dev/null +++ b/graphical/network.nix @@ -0,0 +1,15 @@ +{ ... }: +{ + networking.networkmanager.enable = true; + systemd.services.NetworkManager-wait-online.enable = true; + services.resolved = { + enable = true; + fallbackDns = [ + "103.1.206.179" + "168.138.8.38" + "168.138.12.137" + ]; + dnssec = "false"; + }; + services.mullvad-vpn.enable = true; +} diff --git a/home/programs/bitwarden.nix b/graphical/password-manager.nix similarity index 59% rename from home/programs/bitwarden.nix rename to graphical/password-manager.nix index 94f79b6..1fd5cab 100644 --- a/home/programs/bitwarden.nix +++ b/graphical/password-manager.nix @@ -1,6 +1,6 @@ { pkgs, ... }: { - programs.rbw = { + hm.programs.rbw = { enable = true; settings = { email = "boss@atagen.co"; @@ -8,6 +8,7 @@ base_url = "https://v.atagen.co"; }; }; + hm.programs.git.extraConfig.credential.helper = "rbw"; - home.packages = [ pkgs.bitwarden ]; + hm.home.packages = [ pkgs.bitwarden ]; } diff --git a/home/modules/theming.nix b/graphical/platform-themes.nix similarity index 66% rename from home/modules/theming.nix rename to graphical/platform-themes.nix index 7436798..dcba441 100644 --- a/home/modules/theming.nix +++ b/graphical/platform-themes.nix @@ -1,17 +1,23 @@ -{ pkgs, rice, ... }: +{ pkgs, config, ... }: +let + inherit (config) rice; +in { - home.packages = [ + # for quickshell + qt.enable = true; + + hm.home.packages = [ pkgs.gtk-engine-murrine ]; - fonts.fontconfig.enable = true; + hm.fonts.fontconfig.enable = true; - qt = { + hm.qt = { enable = true; style.name = "adwaita-dark"; platformTheme.name = "adwaita"; }; - gtk = { + hm.gtk = { enable = true; theme = { inherit (rice.gtk-theme) package name; diff --git a/home/util/ez.nix b/graphical/quick-services.nix similarity index 64% rename from home/util/ez.nix rename to graphical/quick-services.nix index 678c565..9e97a4b 100644 --- a/home/util/ez.nix +++ b/graphical/quick-services.nix @@ -4,27 +4,20 @@ ... }: { - options = { - ezServices = + config.hm.options = { + quickServices = with lib; mkOption { type = with types; attrsOf str; default = { }; }; - ezOneShots = + quickOneShots = with lib; mkOption { type = with types; attrsOf str; default = { }; }; - ezConf = - with lib; - mkOption { - type = with types; attrsOf path; - default = { }; - }; - # for specifying an additional systemd target extraTarget = with lib; @@ -34,21 +27,21 @@ }; }; - config = { + config.hm.config = { systemd.user.services = builtins.mapAttrs (name: cmd: { Unit = { Description = "${name}"; - Requires = [ "graphical-session.target" ] ++ config.extraTarget; - After = [ "graphical-session.target" ] ++ config.extraTarget; + Requires = [ "graphical-session.target" ] ++ config.hm.extraTarget; + After = [ "graphical-session.target" ] ++ config.hm.extraTarget; }; Service = { ExecStart = cmd; }; Install = { - WantedBy = [ "graphical-session.target" ] ++ config.extraTarget; + WantedBy = [ "graphical-session.target" ] ++ config.hm.extraTarget; }; - }) config.ezServices + }) config.hm.quickServices // builtins.mapAttrs (name: cmd: { Unit = { Description = "${name}"; @@ -61,11 +54,6 @@ Install = { WantedBy = [ "graphical-session.target" ] ++ config.extraTarget; }; - }) config.ezOneShots; - - xdg.configFile = builtins.mapAttrs (_name: value: { - enable = true; - source = value; - }) config.ezConf; + }) config.hm.quickOneShots; }; } diff --git a/graphical/rice.nix b/graphical/rice.nix new file mode 100644 index 0000000..d5ddaba --- /dev/null +++ b/graphical/rice.nix @@ -0,0 +1,106 @@ +{ + pkgs, + userPkgs, + config, + inputs, + ... +}: +{ + hm.home.packages = + let + inherit (config.rice) icons fonts cursor; + in + fonts.pkgs + ++ icons.pkgs + ++ [ + cursor.package + ]; + rice = { + fonts = + let + sans = { + name = "Inria Sans"; + size = 12; + package = pkgs.inriafonts; + }; + serif = { + name = "Inria Serif"; + size = 12; + package = pkgs.inriafonts; + }; + monospace = { + name = "Fira Code"; + size = 10; + package = pkgs.fira-code; + }; + emoji = { + name = "Twitter Color Emoji"; + size = 12; + package = pkgs.twemoji-color-font; + }; + in + { + inherit + sans + serif + monospace + emoji + ; + pkgs = [ + sans.package + serif.package + monospace.package + emoji.package + pkgs.meslo-lgs-nf + ]; + }; + + icons = + let + package = pkgs.papirus-icon-theme; + in + { + inherit package; + name = "Papirus-Dark"; + pkgs = [ + package + ]; + }; + + gtk-theme = { + name = "nix-rice"; + package = pkgs.callPackage userPkgs.gtk-theme { palette = config.rice.palette.shortHex; }; + }; + + borders = { + thickness = 6; + rounding = 0; + gaps_in = 32; + gaps_out = 72; + }; + + bg = { + src = builtins.path { + name = "wallpaper.jpg"; + path = ./rice/wallpaper.jpg; + sha256 = "2db3f9d0397fbd4746ada297bd14c0c7d3e22c7d4e894968fcfece90bbfb902a"; + }; + }; + + cursor = { + package = pkgs.afterglow-cursors-recolored.override { + themeVariants = [ "Dracula" ]; + draculaColorVariants = [ "Orange" ]; + }; + name = "Afterglow-Recolored-Dracula-Orange"; + }; + + plymouth = { + theme = "starship"; + font = "${config.rice.fonts.sans.package}/share/fonts/truetype/InriaSans-Regular.ttf"; + themePackages = [ + inputs.hudcore.packages.${pkgs.system}.default + ]; + }; + }; +} diff --git a/rice/wallpaper.jpg b/graphical/rice/wallpaper.jpg similarity index 100% rename from rice/wallpaper.jpg rename to graphical/rice/wallpaper.jpg diff --git a/graphical/shell.nix b/graphical/shell.nix new file mode 100644 index 0000000..86bc217 --- /dev/null +++ b/graphical/shell.nix @@ -0,0 +1,76 @@ +{ + pkgs, + lib, + inputs, + mainUser, + config, + ... +}: +let + inherit (lib) getExe getExe'; + inherit (config) rice; +in +{ + # quickshell stuff + environment.systemPackages = + builtins.attrValues { + inherit (pkgs.kdePackages) qtbase qtdeclarative; + inherit (pkgs) wl-clipboard; + } + ++ [ + (inputs.quickshell.packages.${pkgs.system}.default.override { + withHyprland = false; + withI3 = false; + }) + ]; + + hm.systemd.user.services.quickshell = { + Unit.PartOf = [ "graphical-session.target" ]; + Unit.After = [ + "graphical-session.target" + "niri.service" + ]; + Install.WantedBy = [ "graphical-session.target" ]; + Service = { + ExecStart = "${getExe' (inputs.quickshell.packages.${pkgs.system}.default.override { + withHyprland = false; + withI3 = false; + }) "qs"}"; + }; + }; + + hm.quickServices = { + "swaync" = "${getExe pkgs.swaynotificationcenter}"; + "swaybg" = "${getExe pkgs.swaybg} -m fill -i ${rice.bg.src}"; + "swayidle" = + let + niri = inputs.niri.packages.${pkgs.system}.niri-unstable; + systemctl = getExe' pkgs.systemd "systemctl"; + in + '' + ${lib.getExe pkgs.swayidle} -w \ + timeout 1800 '${systemctl} suspend' \ + timeout 600 '${niri} msg action power-off-monitors' + ''; + }; + + hm.systemd.user.targets.tray = { + Unit = { + Description = "Home Manager System Tray"; + Requires = [ "graphical-session.target" ]; + }; + }; + + imports = [ inputs.arbys.nixosModules.arbys ]; + environment = { + arbys = { + enable = true; + clobber = true; + }; + files."/home/${mainUser}/.config/quickshell" = { + source = "/home/${mainUser}/.nix/graphical/shell/quickshell"; + uid = 1000; + gid = 100; + }; + }; +} diff --git a/graphical/shell/quickshell/bink/Bink.qml b/graphical/shell/quickshell/bink/Bink.qml new file mode 100644 index 0000000..8498bdd --- /dev/null +++ b/graphical/shell/quickshell/bink/Bink.qml @@ -0,0 +1,133 @@ +pragma ComponentBehavior: Bound + +import QtQuick + +Rectangle { + id: base + anchors { + fill: parent + margins: 2 + } + color: colours[0] + + required property string format + required property var colours + property var clock: genClock(format) + property var date: new Date() + property string time: date.toLocaleString(Qt.locale()) + property int cols: getColSum(clock) + property real colWidth: (base.width - topgrid.spacing - base.anchors.margins) / cols + + property var keys: { + "a": [(date.getHours() > 11) | 0, -1], + "H": [-1].concat(binarise(date.getHours(), 5)), + "h": binarise(date.getHours() % 12, 4), + "m": binarise(date.getMinutes(), 6), + "s": binarise(date.getSeconds(), 6) + } + + function genClock(format) { + return format.split('').map(k => keys[k]); + } + + function getColSum(clock) { + return clock.map(x => Math.ceil(x.length / 2)).reduce((acc, el) => acc + el); + } + + function binarise(n, p) { + return n.toString(2) // to base-2 string + .padStart(p, 0) // zero pad + .split('') // split to array + .slice(-p) // take only desired bits, lsb first + .map(x => parseInt(x)); // map to int + } + Grid { + id: topgrid + rows: 1 + columns: base.clock.length + spacing: 2 + anchors.fill: parent + + Repeater { + model: base.clock.length + Grid { + id: inner + required property int index + property var bits: base.clock[index] + property int cols: bits.length / 2 + width: base.colWidth * cols + height: base.height + rows: 2 + columns: cols + spacing: 1 + + function calcBitSize() { + let cell = inner.width - inner.spacing * 2; + let def = (cell / inner.cols); + return (def > inner.height / 2) ? inner.height / 2 : def; + } + + Repeater { + model: inner.bits.length + Rectangle { + required property int index + height: inner.calcBitSize() + width: height + color: "transparent" + Rectangle { + property int bit: inner.bits[parent.index] + property string on: base.colours[1] + property string off: base.colours[0] + anchors { + horizontalCenter: parent.horizontalCenter + verticalCenter: parent.verticalCenter + } + height: parent.height + width: parent.width + + border.width: 1 + border.color: bit == -1 ? off : on + color: (bit == -1 || !bit) ? off : on + Behavior on color { + ColorAnimation { + duration: 150 + } + } + radius: height + + // + // height: bit ? parent.height / 3 * 2 : parent.height + // Behavior on height { + // NumberAnimation { + // duration: 50 + // } + // } + // width: bit ? 1 : height + // Behavior on width { + // NumberAnimation { + // duration: 50 + // } + // } + // radius: bit ? 0 : height + // Behavior on radius { + // NumberAnimation { + // duration: 50 + // } + // } + + } + } + } + } + } + + Timer { + interval: 1000 + running: true + repeat: true + onTriggered: { + base.date = new Date(); + } + } + } +} diff --git a/graphical/shell/quickshell/launcher/Launcher.qml b/graphical/shell/quickshell/launcher/Launcher.qml new file mode 100644 index 0000000..2a23a9e --- /dev/null +++ b/graphical/shell/quickshell/launcher/Launcher.qml @@ -0,0 +1,222 @@ +pragma ComponentBehavior: Bound + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell +import Quickshell.Wayland +import Quickshell.Widgets +import Quickshell.Io + +Singleton { + id: topLevel + required property real width + + Timer { + id: closeTimer + interval: 400 + running: false + repeat: false + onTriggered: launcherData.active = false + } + + PersistentProperties { + id: launcherData + property bool open: false + property bool active: false + property real curWidth: 0 + onOpenChanged: { + if (open) { + curWidth = topLevel.width; + launcherData.active = true; + } else { + curWidth = 0; + closeTimer.start(); + } + } + Behavior on curWidth { + NumberAnimation { + duration: 400 + easing.type: Easing.InOutQuad + } + } + } + + IpcHandler { + target: "launch" + function open(): void { + launcherData.open = true; + } + function close(): void { + launcherData.open = false; + } + function toggle(): void { + launcherData.open = !launcherData.open; + } + } + + LazyLoader { + id: loader + activeAsync: launcherData.active + + PanelWindow { + id: launcherBase + + anchors { + top: true + bottom: true + right: true + } + + color: "transparent" + implicitWidth: topLevel.width + + WlrLayershell.layer: WlrLayer.Overlay + focusable: true + exclusionMode: ExclusionMode.Ignore + WlrLayershell.namespace: "shell:launcher" + WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive + // launcherData.curWidth + + Rectangle { + color: "#ffab5b" + anchors { + fill: parent + topMargin: parent.height / 3 + bottomMargin: anchors.topMargin + leftMargin: topLevel.width - launcherData.curWidth + } + bottomLeftRadius: 10 + // topLeftRadius: 10 + + Rectangle { + color: "#272a2a" + anchors { + fill: parent + topMargin: 3 + bottomMargin: 3 + leftMargin: 3 + } + bottomLeftRadius: 10 + // topLeftRadius: 10 + // implicitWidth: topLevel.width + + TextField { + id: searchField + anchors { + top: parent.top + left: parent.left + right: parent.right + topMargin: 10 + leftMargin: 10 + } + font { + family: "Inria Sans" + pointSize: 12 + } + color: "#202e2f" + height: 24 + background: Rectangle { + color: "#caccce" + radius: 5 + } + focus: true + + Keys.forwardTo: [list] + Keys.onEscapePressed: launcherData.open = false + + onAccepted: { + if (list.currentItem) { + list.currentItem.clicked(null); + } + } + } + + Rectangle { + id: emptyScrollbar + anchors { + left: parent.left + top: searchField.bottom + bottom: list.bottom + topMargin: 6 + bottomMargin: 4 + leftMargin: 4 + } + color: "#3a5299ff" + width: 3 + radius: 10 + } + + ListView { + id: list + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + top: searchField.bottom + topMargin: 4 + leftMargin: 12 + bottomMargin: 12 + } + clip: true + cacheBuffer: 0 + model: ScriptModel { + values: DesktopEntries.applications.values.map(x => x).filter(entry => { + const search = searchField.text.toLowerCase(); + const name = entry.name.toLowerCase(); + return search.length ? name.indexOf(search) > -1 : true; + }) + } + onModelChanged: list.currentIndex = 0 + highlight: Rectangle { + anchors { + left: parent.left + right: parent.right + } + color: "#7f5299ff" + border.color: "#928cc9" + border.width: 2 + } + spacing: 0 + delegate: MouseArea { + id: clickableEntry + required property DesktopEntry modelData + onClicked: { + modelData.execute(); + launcherData.open = false; + } + implicitHeight: 24 + implicitWidth: ListView.view.width + + RowLayout { + id: rowEntry + + anchors { + left: parent.left + leftMargin: 4 + verticalCenter: parent.verticalCenter + } + + IconImage { + asynchronous: true + implicitSize: 18 + source: Quickshell.iconPath(clickableEntry.modelData.icon) + } + + Text { + font { + family: "Inria Sans" + pointSize: 12 + } + color: "#ffab5b" + text: clickableEntry.modelData.name + Layout.alignment: Qt.AlignBottom + } + } + } + } + } + } + } + } +} diff --git a/graphical/shell/quickshell/noti/Noti.qml b/graphical/shell/quickshell/noti/Noti.qml new file mode 100644 index 0000000..81127ff --- /dev/null +++ b/graphical/shell/quickshell/noti/Noti.qml @@ -0,0 +1,18 @@ +pragma Singleton + +import Quickshell +import Quickshell.Services.Notifications + +Singleton { + NotificationServer { + id: notifications + actionsSupported: true + bodyHyperlinksSupported: true + // bodyImagesSupported: true + bodyMarkupSupported: true + imageSupported: true + onNotification: noti => { + + } + } +} diff --git a/graphical/shell/quickshell/particle-test/particle-test.qml b/graphical/shell/quickshell/particle-test/particle-test.qml new file mode 100644 index 0000000..b4262c3 --- /dev/null +++ b/graphical/shell/quickshell/particle-test/particle-test.qml @@ -0,0 +1,84 @@ +import Quickshell +import QtQuick +import QtQuick.Particles + + +PanelWindow { + id: particleRoot + anchors { + top: true + bottom: true + left: true + right: true + } + color: "transparent" + exclusionMode: ExclusionMode.Ignore + + screen: Quickshell.screens.find(s => s.name == "DP-1") + property var mousePos: [width/2, height/2] + MouseArea { + id: mouse + anchors.fill: parent + hoverEnabled: true + onPositionChanged: { + particleRoot.mousePos = [mouse.x, mouse.y]; + } + } + + ParticleSystem { + id: sys + running: true + anchors.fill: parent + + ItemParticle { + system: sys + delegate: Component { + Rectangle { + color: "black" + width: 7 + height: width + radius: width + Rectangle { + color: "white" + width: 5 + height: width + radius: width + } + } + } + } + + Emitter { + system: sys + // x: particleRoot.mousePos[0]-10 + // y: particleRoot.mousePos[1]-10 + x: particleRoot.width/2 + y: particleRoot.height/2 + height: 60 + width: 60 + emitRate: 200 + lifeSpan: 3000 + startTime: 0 + velocity: CumulativeDirection { + + AngleDirection { + angle: 0 + angleVariation: 360 + magnitude: 10 + magnitudeVariation: 0.2 + } + + + } + } + + Attractor { + pointX: particleRoot.mousePos[0] + pointY: particleRoot.mousePos[1] + strength: 200 + affectedParameter: Attractor.Position + proportionalToDistance: Attractor.InverseLinear + } + } + + } diff --git a/graphical/shell/quickshell/rice/Colours.qml b/graphical/shell/quickshell/rice/Colours.qml new file mode 100644 index 0000000..f0cd711 --- /dev/null +++ b/graphical/shell/quickshell/rice/Colours.qml @@ -0,0 +1,34 @@ +pragma Singleton +import Quickshell + +Singleton { + property var c: { + "bg": "#1b2021", + "fg": "#cecbca", + + "black": "#272a2a", + "black_b": "#202e2f", + + "red": "#c43325", + "red_b": "#c46056", + + "green": "#8cc992", + "green_b": "#c2dab0", + + "yellow": "#ffb852", + "yellow_b": "#ffab5b", + + "blue": "#5299ff", + "blue_b": "#92beff", + + "magenta": "#645ac9", + "magenta_b": "#928cc9", + + "cyan": "#5abfc9", + "cyan_b": "#8cc4c9", + + "white": "#b0c2da", + "white_b": "#caccce", + + } +} diff --git a/graphical/shell/quickshell/shell.qml b/graphical/shell/quickshell/shell.qml new file mode 100644 index 0000000..a577dac --- /dev/null +++ b/graphical/shell/quickshell/shell.qml @@ -0,0 +1,212 @@ +// components +import "bink" as Bink +import "launcher" as Launcher +// singletons +import "title" +import "tags" +import "rice" +import Quickshell +import Quickshell.Wayland +import QtQuick +import QtQuick.Controls + +ShellRoot { + // rhs main + Variants { + model: Quickshell.screens.filter(s => s.name == "DP-2") + delegate: PanelWindow { + id: bink + property var modelData + + anchors { + top: true + right: true + } + + implicitHeight: 22 + implicitWidth: 115 + color: "transparent" + + Rectangle { + anchors.fill: parent + bottomLeftRadius: 10 + color: Colours.c.black + } + + Rectangle { + anchors { + leftMargin: 8 + bottomMargin: 3 + fill: parent + } + color: Colours.c.black + bottomLeftRadius: 10 + Bink.Bink { + format: "ahms" + colours: ["transparent", Colours.c.yellow_b] + } + } + + exclusionMode: ExclusionMode.Ignore + WlrLayershell.layer: WlrLayer.Top + screen: modelData + } + } + + // centre main + Variants { + model: Quickshell.screens.filter(s => s.name == "DP-2") + delegate: PanelWindow { + id: windowTitle + property var modelData + anchors { + top: true + } + + TextMetrics { + id: textInfo + font { + family: "Inria Sans" + pointSize: 12 + } + elideWidth: 550 + elide: Qt.ElideMiddle + text: Title.currentWindow + } + + implicitHeight: textInfo.height + 6 + implicitWidth: (textInfo.width > textInfo.elideWidth ? textInfo.elideWidth : textInfo.width) + 24 + Behavior on implicitWidth { + NumberAnimation { + duration: 150 + easing.type: Easing.InOutQuad + } + } + color: "transparent" + + Rectangle { + anchors { + fill: parent + } + color: Colours.c.black + bottomLeftRadius: 10 + bottomRightRadius: 10 + + Rectangle { + anchors { + fill: parent + leftMargin: 12 + rightMargin: 12 + topMargin: 4 + } + color: "transparent" + Text { + font { + family: "Inria Sans" + pointSize: 12 + } + color: Colours.c.yellow_b + text: textInfo.elidedText + } + } + } + + exclusionMode: ExclusionMode.Ignore + WlrLayershell.layer: WlrLayer.Top + screen: modelData + } + } + + // bottom middle main + Variants { + model: Quickshell.screens.filter(s => s.name == "DP-2") + delegate: PanelWindow { + id: tags + property var modelData + anchors { + bottom: true + } + + implicitHeight: 22 + implicitWidth: Tags.keys.length * 13 + 24 + // implicitWidth:.width + 24 + color: "transparent" + + Rectangle { + anchors { + fill: parent + } + color: Colours.c.black + topLeftRadius: 10 + topRightRadius: 10 + + Rectangle { + anchors { + fill: parent + leftMargin: 12 + rightMargin: 12 + topMargin: 3 + } + Row { + anchors { + fill: parent + } + spacing: 1 + Repeater { + model: Tags.keys + delegate: Column { + id: baseCol + required property var modelData + spacing: 3 + Rectangle { + property var tag: Tags.tags[baseCol.modelData] + width: 12 + height: width + radius: width + color: tag.urgent ? Colours.c.red_b : (tag.enabled) ? Colours.c.yellow_b : Colours.c.black + Behavior on color { + ColorAnimation { + duration: 300 + } + } + border { + width: 1 + color: tag.urgent ? Colours.c.red_b : Colours.c.yellow_b + Behavior on color { + ColorAnimation { + duration: 300 + } + } + } + } + Rectangle { + property var tag: Tags.tags[baseCol.modelData] + anchors.horizontalCenter: parent.horizontalCenter + width: 1 + height: 1 + color: tag.urgent ? Colours.c.red_b : (tag.occupied) ? Colours.c.yellow_b : Colours.c.black + Behavior on color { + ColorAnimation { + duration: 300 + } + } + } + } + } + } + color: "transparent" + } // inner container + + }// outer visible rect + + exclusionMode: ExclusionMode.Ignore + WlrLayershell.layer: WlrLayer.Top + screen: modelData + }//invisible rect + } + + // pops up on current monitor + Launcher.Launcher { + width: 190 + } +} diff --git a/graphical/shell/quickshell/tags/Tags.qml b/graphical/shell/quickshell/tags/Tags.qml new file mode 100644 index 0000000..ab99b91 --- /dev/null +++ b/graphical/shell/quickshell/tags/Tags.qml @@ -0,0 +1,80 @@ +pragma Singleton + +import QtQuick +import Quickshell +import Quickshell.Io + +Singleton { + id: data + property var tags: {} + property var keys: [] + Timer { + id: reconnectTimer + running: false + repeat: true + onTriggered: () => sock.connected = true + interval: 5000 + } + + Socket { + id: sock + connected: true + onConnectionStateChanged: () => { + reconnectTimer.running = sock.connected ? false : true + if (!sock.connected) { + data.tags = {} + data.keys = [] + } + } + path: Quickshell.env("XDG_RUNTIME_DIR") + "/niri-tag-events.sock" + parser: SplitParser { + onRead: tag_data => { + let event = JSON.parse(tag_data); + + let ensure = (d, t) => { + if (!d[t]) { + d[t] = { + occupied: false, + urgent: false, + enabled: false, + id: t + }; + } + return d; + }; + + if (event.TagEmpty) { + data.tags = ensure(data.tags, event.TagEmpty); + data.tags[event.TagEmpty].occupied = false; + } else if (event.TagOccupied) { + data.tags = ensure(data.tags, event.TagOccupied); + data.tags[event.TagOccupied].occupied = true; + } else if (event.TagUrgent) { + data.tags = ensure(data.tags, event.TagUrgent); + data.tags[event.TagUrgent].urgent = true; + } else if (event.TagEnabled) { + data.tags = ensure(data.tags, event.TagEnabled); + data.tags[event.TagEnabled].enabled = true; + } else if (event.TagDisabled) { + data.tags = ensure(data.tags, event.TagDisabled); + data.tags[event.TagDisabled].enabled = false; + } else if (event.TagExclusive) { + data.tags = ensure(data.tags, event.TagExclusive); + for (const [k] of Object.keys(data.tags)) { + data.tags[k].enabled = false; + } + data.tags[event.TagExclusive].enabled = true; + } else if (event.TagFullState) { + data["tags"] = event.TagFullState; + for (const [k, v] of Object.entries(data.tags)) { + data.tags[k].id = k; + } + } + + data.keys = Object.keys(data.tags); + data.tagsChanged(); + data.keysChanged(); + } + } + } +} diff --git a/graphical/shell/quickshell/title/Title.qml b/graphical/shell/quickshell/title/Title.qml new file mode 100644 index 0000000..7563d59 --- /dev/null +++ b/graphical/shell/quickshell/title/Title.qml @@ -0,0 +1,52 @@ +pragma Singleton + +import QtQuick +import Quickshell +import Quickshell.Io + +Singleton { + id: data + property var currentWindow: " " + property var currentId: 0 + property var windows: {} + Process { + id: proc + command: ["niri", "msg", "-j", "event-stream"] + running: true + stdout: SplitParser { + onRead: niri_data => { + var event = JSON.parse(niri_data); + if (event.WindowsChanged) { + let new_data = event.WindowsChanged.windows.reduce((acc, el) => { + acc[el.id] = el.title == "" ? el.app_id : el.title; + return acc; + }, {}); + data.windows = new_data; + let focused = event.WindowsChanged.windows.find(w => w.is_focused); + if (focused === undefined) { + data.currentId = 0; + } + } else if (event.WindowOpenedOrChanged) { + let target = event.WindowOpenedOrChanged.window; + data.windows[target.id] = target.title == "" ? target.app_id : target.title; + if (target.is_focused) { + data.currentId = target.id; + } + } else if (event.WindowClosed) { + delete data[event.WindowClosed.id]; + if (Object.keys(data).length == 0) { + data.currentId = 0; + } + } else if (event.WindowFocusChanged) { + if (event.WindowFocusChanged.id === null) { + data.currentId = 0; + } else { + data.currentId = event.WindowFocusChanged.id; + } + } + + data.currentWindow = data.currentId == 0 ? " " : data.windows[data.currentId]; + } + } + } +} diff --git a/system/modules/sound.nix b/graphical/sound.nix similarity index 100% rename from system/modules/sound.nix rename to graphical/sound.nix diff --git a/graphical/terminal.nix b/graphical/terminal.nix new file mode 100644 index 0000000..272ecb8 --- /dev/null +++ b/graphical/terminal.nix @@ -0,0 +1,41 @@ +{ config, ... }: +{ + hm.programs.kitty = + let + inherit (config) rice; + in + { + enable = true; + font = { + inherit (rice.fonts.monospace) name size; + }; + settings = with rice.palette.hex; { + foreground = util.fg; + background = util.bg; + inherit (util) cursor; + cursor_text = util.bg; + selection_foreground = util.fg_sel; + selection_background = util.bg_sel; + color0 = normal.black; + color1 = normal.red; + color2 = normal.green; + color3 = normal.yellow; + color4 = normal.blue; + color5 = normal.magenta; + color6 = normal.cyan; + color7 = normal.white; + color8 = bright.black; + color9 = bright.red; + color10 = bright.green; + color11 = bright.yellow; + color12 = bright.blue; + color13 = bright.magenta; + color14 = bright.cyan; + color15 = bright.white; + sync_to_monitor = "yes"; + shell = "fish"; + cursor_trail = 100; + }; + }; + +} diff --git a/graphical/udisks.nix b/graphical/udisks.nix new file mode 100644 index 0000000..4f2ad7a --- /dev/null +++ b/graphical/udisks.nix @@ -0,0 +1,17 @@ +{ lib, pkgs, ... }: +{ + services.udisks2.enable = true; + hm.services.udiskie.enable = true; + # fix reliance on nonexistent graphical-session-pre.target + hm.systemd.user.services.udiskie = lib.mkForce { + Unit = { + Description = "udiskie mount daemon"; + After = [ ]; + PartOf = [ "graphical-session.target" ]; + }; + + Service.ExecStart = [ "${pkgs.udiskie}/bin/udiskie --appindicator" ]; + + Install.WantedBy = [ "graphical-session.target" ]; + }; +} diff --git a/graphical/webapps.nix b/graphical/webapps.nix new file mode 100644 index 0000000..4559686 --- /dev/null +++ b/graphical/webapps.nix @@ -0,0 +1,14 @@ +{ config, ... }: +{ + imports = [ + ./webapps/firefox-webapp.nix + ]; + hm.programs.firefox.webapps = { + "Open-WebUI" = { + url = "http://127.0.0.1:8088"; + extraSettings = config.hm.programs.firefox.profiles.default.settings; + name = "Open-WebUI"; + icon = ../assets/openwebui.png; + }; + }; +} diff --git a/home/util/firefox-webapp.nix b/graphical/webapps/firefox-webapp.nix similarity index 95% rename from home/util/firefox-webapp.nix rename to graphical/webapps/firefox-webapp.nix index 7dbe7a5..e78d120 100644 --- a/home/util/firefox-webapp.nix +++ b/graphical/webapps/firefox-webapp.nix @@ -96,7 +96,7 @@ let ) cfg; in { - options.programs.firefox.webapps = mkOption { + config.hm.options.programs.firefox.webapps = mkOption { default = { }; type = @@ -210,8 +210,8 @@ in description = "Websites to create special site-specific Firefox instances for."; }; - config = { - programs.firefox.profiles = make-app-profiles (enumerate config.programs.firefox.webapps); + config.hm.config = { + programs.firefox.profiles = make-app-profiles (enumerate config.hm.programs.firefox.webapps); xdg.desktopEntries = mapAttrs (name: cfg: { inherit (cfg) @@ -235,7 +235,7 @@ in exec = concatStringsSep " " ( [ - "${getExe config.programs.firefox.package}" + "${getExe config.hm.programs.firefox.package}" "--name" "${name}" "--app-id" @@ -243,7 +243,7 @@ in "--class" "${name}" "-P" - "${config.programs.firefox.profiles."home-manager-webapp-${name}".path}" + "${config.hm.programs.firefox.profiles."home-manager-webapp-${name}".path}" "--no-remote" ] ++ cfg.extraArgs @@ -255,6 +255,6 @@ in StartupWMClass = "${name}"; NoDisplay = lib.boolToString cfg.hidden; }; - }) config.programs.firefox.webapps; + }) config.hm.programs.firefox.webapps; }; } diff --git a/home/util/local-webapp.nix b/graphical/webapps/local-webapp.nix similarity index 97% rename from home/util/local-webapp.nix rename to graphical/webapps/local-webapp.nix index a42c977..25d1268 100644 --- a/home/util/local-webapp.nix +++ b/graphical/webapps/local-webapp.nix @@ -29,7 +29,7 @@ let nameValuePair "${name}-client" { inherit (cfg) name; url = "http://127.0.0.1:${builtins.toString cfg.port}"; - extraSettings = config.programs.firefox.profiles.default.settings; + extraSettings = config.hm.programs.firefox.profiles.default.settings; hidden = true; } ) cfg; @@ -168,10 +168,10 @@ let '' }"; }) cfg; - cfg = config.localWebApps; + cfg = config.hm.localWebApps; in { - options.localWebApps = mkOption { + config.hm.options.localWebApps = mkOption { default = { }; type = with lib.types; @@ -240,7 +240,7 @@ in }); }; - config = { + config.hm.config = { programs.firefox.webapps = make-firefox cfg; systemd.user.targets = make-systemd-target cfg; diff --git a/graphical/wm.nix b/graphical/wm.nix new file mode 100644 index 0000000..8a29c04 --- /dev/null +++ b/graphical/wm.nix @@ -0,0 +1,88 @@ +{ + pkgs, + mainUser, + inputs, + config, + ... +}: +let + inherit (config) rice; +in +{ + imports = [ + inputs.niri.nixosModules.niri + inputs.niri-tag.nixosModules.niri-tag + ]; + hm.programs.niri.settings = { + input = { + warp-mouse-to-focus.enable = true; + }; + cursor = { + hide-after-inactive-ms = 5000; + hide-when-typing = true; + size = 16; + theme = rice.cursor.name; + }; + layout = { + always-center-single-column = true; + gaps = 24; + default-column-width.proportion = 0.5; + preset-column-widths = map (p: { proportion = p; }) [ + (2.0 / 3.0) + 0.5 + (1.0 / 3.0) + ]; + focus-ring = + let + pal = rice.palette.hex; + in + { + active = { + color = pal.bright.yellow; + }; + inactive = { + color = pal.normal.black; + }; + }; + }; + prefer-no-csd = true; + hotkey-overlay.skip-at-startup = true; + window-rules = + let + v = 10.0; + in + [ + { + geometry-corner-radius = { + bottom-left = v; + bottom-right = 0.0; + top-left = 0.0; + top-right = v; + }; + clip-to-geometry = true; + } + ]; + }; + + services.greetd = { + enable = true; + restart = false; + settings = + let + session = { + command = "niri-session"; + user = "${mainUser}"; + }; + in + { + default_session = session; + initial_session = session; + }; + }; + programs.niri = { + enable = true; + package = inputs.niri.packages.${pkgs.system}.niri-unstable; + }; + services.niri-tag.enable = true; + +} diff --git a/home/bolt.nix b/home/bolt.nix deleted file mode 100644 index b9f796e..0000000 --- a/home/bolt.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - ... -}: -{ - - imports = [ - ./home.nix - ]; - -} diff --git a/home/dots/Xresources b/home/dots/Xresources deleted file mode 100644 index af1d2c9..0000000 --- a/home/dots/Xresources +++ /dev/null @@ -1,37 +0,0 @@ - -! special -*.foreground: #d3dae3 -*.background: #181b28 -*.cursorColor: #d3dae3 - -! black -*.color0: #2f343f -*.color8: #1e2233 - -! red -*.color1: #ed244e -*.color9: #da4453 - -! green -*.color2: #27ae60 -*.color10: #71f79f - -! yellow -*.color3: #f67400 -*.color11: #fdbc4b - -! blue -*.color4: #2980b9 -*.color12: #1d99f3 - -! magenta -*.color5: #c50ed2 -*.color13: #9b59b6 - -! cyan -*.color6: #3daee9 -*.color14: #5294e2 - -! white -*.color7: #a1a9b1 -*.color15: #656a73 \ No newline at end of file diff --git a/home/dots/wlogout/style.css b/home/dots/wlogout/style.css deleted file mode 100644 index ce6b1fd..0000000 --- a/home/dots/wlogout/style.css +++ /dev/null @@ -1,48 +0,0 @@ -* { - background-image: none; -} -window { - background-color: #WINBG; -} -button { - color: #BTNCOL; - background-color: #BTNBG; - border-style: solid; - border-width: 2px; - background-repeat: no-repeat; - background-position: center; - background-size: 25%; -} - -button:focus, button:active, button:hover { - background-color: #BTNFOCUSBG; - outline-style: none; -} - -#lock { - background-image: image(url("/usr/share/wlogout/icons/lock.png"), url("/usr/local/share/wlogout/icons/lock.png")); -} - -#logout { - background-image: image(url("/usr/share/wlogout/icons/logout.png"), url("/usr/local/share/wlogout/icons/logout.png")); -} - -#suspend { - background-image: image(url("/usr/share/wlogout/icons/suspend.png"), url("/usr/local/share/wlogout/icons/suspend.png")); -} - -#hibernate { - background-image: image(url("/usr/share/wlogout/icons/hibernate.png"), url("/usr/local/share/wlogout/icons/hibernate.png")); -} - -#shutdown { - background-image: image(url("/usr/share/wlogout/icons/shutdown.png"), url("/usr/local/share/wlogout/icons/shutdown.png")); -} - -#reboot { - background-image: image(url("/usr/share/wlogout/icons/reboot.png"), url("/usr/local/share/wlogout/icons/reboot.png")); -} - -#windows { - background-image: image(url("#WINLOGO")) -} diff --git a/home/dots/zsh b/home/dots/zsh deleted file mode 100644 index 1a13aa9..0000000 --- a/home/dots/zsh +++ /dev/null @@ -1,44 +0,0 @@ -[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh - -la_culr() -{ - eza -lha --group-directories-first --icons --color=always $@ | culr -t 80 -o roygbiv-split -} - -ls_culr() -{ - eza -lh --group-directories-first --icons --color=always $@ | culr -t 80 -o roygbiv-split -} - -ps_culr() -{ - ps ww$@ | culr -t 80 -o roygbiv-split -} - -alias ...='cd ../..' -alias ....='cd ../../..' -alias .....='cd ../../../..' - -alias fresh='clear; echo; ~/.nix/header.sh' -alias icat='kitty +kitten icat' -alias chmox='chmod +x' -alias gs='git status' -alias gcl='git clone' -alias ga='git add' -alias gcb='git checkout -b' -alias gco='git checkout' -alias gl='git pull' -alias gp='git push' -alias gd='git diff' -alias gcam='git commit -am' -alias gcm='git commit -m' -alias gr='git restore' -alias gm='git merge' -alias l='ls_culr' -alias la='la_culr' -alias p='ps_culr' -alias mnt='mount | column -t | culr -t 80 -o roygbiv-split' -alias zz='z $(xplr)' -# alias kaboom='printf "type any input if you wish to update\n\npress enter to continue\n"; read upgrade; if [ -n "$upgrade" ]; then echo upgrading..; sudo nix-channel --update; else echo no upgrade!; fi; sudo nixos-rebuild switch -j9 && rm ~/.gtkrc-2.0; home-manager switch && sudo nix-collect-garbage && nix-store --optimise' -eval "$(zoxide init zsh)" -fresh diff --git a/home/home.nix b/home/home.nix deleted file mode 100644 index 0f069fd..0000000 --- a/home/home.nix +++ /dev/null @@ -1,100 +0,0 @@ -{ - inputs, - lib, - pkgs, - rice, - ... -}: -{ - home.stateVersion = "22.11"; - - imports = [ - ./modules/cli.nix - ./modules/desktop.nix - ./modules/dev.nix - ./modules/theming.nix - ./modules/niri.nix - ./util/ez.nix - ./util/name.nix - inputs.nix-index-database.hmModules.nix-index - ]; - - nix.gc = { - automatic = true; - frequency = "daily"; - options = "--delete-older-than 14d"; - }; - - xdg = { - enable = true; - portal = - let - gtk = pkgs.xdg-desktop-portal-gtk; - gnome = pkgs.xdg-desktop-portal-gnome; - in - { - enable = true; - config = { - common = { - default = [ - "gnome" - ]; - }; - }; - extraPortals = [ - gnome - gtk - ]; - }; - }; - - home.packages = - let - inherit (rice) icons fonts cursor; - in - fonts.pkgs - ++ icons.pkgs - ++ [ - cursor.package - pkgs.tauon - ]; - - systemd.user.targets.tray = { - Unit = { - Description = "Home Manager System Tray"; - Requires = [ "graphical-session.target" ]; - }; - }; - - services.syncthing = { - enable = true; - }; - - services.udiskie.enable = true; - # fix reliance on nonexistent graphical-session-pre.target - systemd.user.services.udiskie = lib.mkForce { - Unit = { - Description = "udiskie mount daemon"; - After = [ ]; - PartOf = [ "graphical-session.target" ]; - }; - - Service.ExecStart = [ "${pkgs.udiskie}/bin/udiskie --appindicator" ]; - - Install.WantedBy = [ "graphical-session.target" ]; - }; - - # programs.nix-index-database.comma.enable = true; - # programs.nix-index = { - # enable = true; - # enableZshIntegration = false; - # enableBashIntegration = false; - # }; - # programs.command-not-found.enable = false; - # programs.nix-index.enable = true; - - systemd.user.startServices = "sd-switch"; - ezServices = { - ckb-next = "${lib.getExe pkgs.ckb-next} -c -b"; - }; -} diff --git a/home/homepkgs/culr.nix b/home/homepkgs/culr.nix deleted file mode 100755 index 0dfa0a0..0000000 --- a/home/homepkgs/culr.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - lib, - fetchFromGitea, - rustPlatform, - libX11, - pkg-config, -}: - -rustPlatform.buildRustPackage rec { - pname = "culr"; - version = "0.1.0"; - - src = fetchFromGitea { - domain = "git.atagen.co"; - owner = "atagen"; - repo = pname; - rev = "8cb1323bdc388ce1fdb0675ade756ea8b59b803d"; - sha256 = "sha256-Blo1PyhzKU4LzflmeGrvWOQEon2BCTkF3uQR+7D5/kc="; - }; - - nativeBuildInputs = [ pkg-config ]; - buildInputs = [ libX11 ]; - - cargoSha256 = "sha256-d8MshgH3EppKR80fULU5kraJzrkG57KApzcJM2muvIE="; - - meta = with lib; { - description = "colourise piped input"; - homepage = "https://git.atagen.co/atagen/culr"; - license = licenses.mit; - maintainers = [ ]; - }; - -} diff --git a/home/icons/syncthing.png b/home/icons/syncthing.png deleted file mode 100644 index cce2b8e..0000000 Binary files a/home/icons/syncthing.png and /dev/null differ diff --git a/home/modules/chat.nix b/home/modules/chat.nix deleted file mode 100644 index c69e984..0000000 --- a/home/modules/chat.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ config, pkgs, ... }: -{ - imports = [ - ../util/firefox-webapp.nix - ]; - programs.firefox.webapps = { - "Microsoft-Teams" = { - url = "https://teams.microsoft.com"; - # id = 1; - extraSettings = config.programs.firefox.profiles.default.settings; - name = "Microsoft Teams"; - icon = ../icons/ms_teams.png; - }; - "Facebook-Messenger" = { - url = "https://www.messenger.com"; - # id = 2; - extraSettings = config.programs.firefox.profiles.default.settings; - name = "Facebook Messenger"; - icon = ../icons/fb_msg.png; - }; - }; - home.packages = [ pkgs.cinny-desktop ]; -} diff --git a/home/modules/cli.nix b/home/modules/cli.nix deleted file mode 100644 index 0c7b494..0000000 --- a/home/modules/cli.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ pkgs, ... }: -{ - imports = [ - ../programs/kitty.nix - # ../programs/zsh.nix - # ../programs/xresources.nix - ../programs/helix.nix - # ../programs/atuin.nix - ]; - home.packages = builtins.attrValues { - inherit (pkgs) - btop-cuda - bat - ripgrep - fd - lazygit - zoxide - zellij - ouch - ; - }; -} diff --git a/home/modules/creative.nix b/home/modules/creative.nix deleted file mode 100644 index e420aa3..0000000 --- a/home/modules/creative.nix +++ /dev/null @@ -1,10 +0,0 @@ -_: { - # imports = [ - # ../util/flatpak.nix - # ]; - # flatpaks = [ - # "ar.com.tuxguitar.TuxGuitar" - # "org.inkscape.Inkscape" - # "com.github.PintaProject.Pinta" - # ]; -} diff --git a/home/modules/desktop.nix b/home/modules/desktop.nix deleted file mode 100644 index 391a3b5..0000000 --- a/home/modules/desktop.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ pkgs, ... }: -{ - imports = [ - ./media-players.nix - ./webapps.nix - ./documents.nix - # ./creative.nix - ./chat.nix - ../programs/firefox.nix - ../programs/wlogout.nix - ../programs/bitwarden.nix - ]; - home.packages = builtins.attrValues { - inherit (pkgs) - file-roller - nautilus - thunderbird - ; - }; -} diff --git a/home/modules/documents.nix b/home/modules/documents.nix deleted file mode 100644 index c8f059d..0000000 --- a/home/modules/documents.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = [ - pkgs.libreoffice - ]; -} diff --git a/home/modules/niri.nix b/home/modules/niri.nix deleted file mode 100644 index 0f54082..0000000 --- a/home/modules/niri.nix +++ /dev/null @@ -1,288 +0,0 @@ -{ - pkgs, - lib, - config, - rice, - inputs, - ... -}: -let - services = - let - inherit (pkgs) swaynotificationcenter; - in - [ - swaynotificationcenter - ]; - errata = - let - inherit (pkgs) avizo playerctl; - in - [ - avizo - playerctl - ]; - extraServices = - let - inherit (pkgs) - swayidle - swaybg - systemd - avizo - ; - - inherit (inputs.niri.packages.x86_64-linux) niri-unstable; - in - [ - { - name = "swaybg"; - value = "${lib.getExe swaybg} -m fill -i ${rice.bg.src}"; - } - { - name = "avizo-service"; - value = "${lib.getExe' avizo "avizo-service"}"; - } - { - name = "swayidle"; - value = - let - niri = lib.getExe niri-unstable; - systemctl = lib.getExe' systemd "systemctl"; - in - '' - ${lib.getExe swayidle} -w \ - timeout 1800 '${systemctl} suspend' \ - timeout 600 '${niri} msg action power-off-monitors' - ''; - } - ]; -in -{ - home.packages = errata; - ezServices = builtins.listToAttrs ( - (map (entry: { - name = "${lib.strings.toLower entry.pname}"; - value = "${lib.getExe entry}"; - }) services) - ++ extraServices - ); - programs.niri.settings = - let - inherit (lib) - range - nameValuePair - mapAttrs' - mergeAttrsList - ; - inherit (builtins) listToAttrs replaceStrings; - inherit (config.lib.niri) actions; - in - { - binds = - let - hBinds = { - H = "left"; - L = "right"; - }; - vBinds = { - J = "down"; - K = "up"; - }; - makeDirBind = - mods: cmd: keys: - mapAttrs' ( - key: dir: - nameValuePair "${mods}+${key}" { - action = actions."${replaceStrings [ "$DIR" ] [ "${dir}" ] "${cmd}"}"; - } - ) keys; - makeWsBind = - mods: cmd: - listToAttrs ( - map (num: { - name = "${mods}+${builtins.toString num}"; - value = { - action."${cmd}" = num; - }; - }) (range 1 6) - ); - tagctl = lib.getExe' inputs.niri-tag.packages.${pkgs.system}.unstable "tagctl"; - makeTagBind = - mods: cmd: - listToAttrs ( - map (num: { - name = "${mods}+${builtins.toString num}"; - value = { - action.spawn = [ - tagctl - cmd - (builtins.toString num) - ]; - }; - }) (range 1 6) - ); - in - mergeAttrsList [ - { - "Mod+D".action.spawn = [ - "qs" - "ipc" - "call" - "launch" - "toggle" - ]; - "Mod+F".action.spawn = "firefox"; - "Mod+E".action.spawn = "nautilus"; - "Mod+Return".action.spawn = "kitty"; - "Mod+Shift+E".action.spawn = "wlogout"; - "Mod+Equal".action.spawn = "bitwarden"; - "Mod+Shift+Q".action = actions.close-window; - "Mod+Shift+S".action = actions.screenshot; - "Mod+R".action = actions.switch-preset-column-width; - "Mod+Shift+R".action = actions.maximize-column; - "XF86AudioRaiseVolume".action.spawn = [ - "volumectl" - "-u" - "up" - ]; - "XF86AudioLowerVolume".action.spawn = [ - "volumectl" - "-u" - "down" - ]; - "XF86AudioMute".action.spawn = [ - "volumectl" - "toggle-mute" - ]; - "XF86AudioStop".action.spawn = [ - "playerctl" - "stop" - ]; - "XF86AudioPlay".action.spawn = [ - "playerctl" - "play-pause" - ]; - "XF86AudioNext".action.spawn = [ - "playerctl" - "next" - ]; - "XF86AudioPrev".action.spawn = [ - "playerctl" - "previous" - ]; - "Mod+Space".action = actions.toggle-window-floating; - } - (makeDirBind "Mod" "focus-window-$DIR" vBinds) - (makeDirBind "Mod" "focus-column-or-monitor-$DIR" hBinds) - (makeDirBind "Mod+Shift" "move-column-$DIR-or-to-monitor-$DIR" hBinds) - (makeDirBind "Mod+Ctrl" "consume-or-expel-window-$DIR" hBinds) - (makeDirBind "Mod+Ctrl" "move-window-$DIR" vBinds) - (makeTagBind "Mod" "toggle-tag") - (makeTagBind "Mod+Shift" "toggle") - (makeTagBind "Mod+Ctrl" "exclusive-tag") - ]; - outputs = { - # "Unknown-1".enable = false; - "DP-1" = { - transform.rotation = 90; - scale = 1; - }; - "DP-2" = { - variable-refresh-rate = true; - scale = 1; - }; - }; - input = { - warp-mouse-to-focus.enable = true; - }; - cursor = { - hide-after-inactive-ms = 5000; - hide-when-typing = true; - size = 16; - theme = rice.cursor.name; - }; - layout = { - always-center-single-column = true; - gaps = 24; - default-column-width.proportion = 0.5; - preset-column-widths = map (p: { proportion = p; }) [ - (2.0 / 3.0) - 0.5 - (1.0 / 3.0) - ]; - focus-ring = - let - pal = rice.palette.hex; - in - { - active = { - color = pal.bright.yellow; - }; - inactive = { - color = pal.normal.black; - }; - }; - }; - prefer-no-csd = true; - hotkey-overlay.skip-at-startup = true; - window-rules = - let - v = 10.0; - in - [ - { - geometry-corner-radius = { - bottom-left = v; - bottom-right = 0.0; - top-left = 0.0; - top-right = v; - }; - clip-to-geometry = true; - } - ]; - }; - - # programs.ironbar = { - # enable = true; - # systemd = true; - # config = { - # monitors."DP-1" = { - # position = "top"; - # height = 16; - # start = [ - # { - # type = "music"; - # player_type = "mpris"; - # } - # ]; - # center = [ - # { - # type = "focused"; - # icon_size = 16; - # truncate = "middle"; - # } - # ]; - # end = [ - # { type = "clock"; } - # { type = "tray"; } - # ]; - # }; - # }; - # }; - - systemd.user.services.quickshell = { - Unit.PartOf = [ "graphical-session.target" ]; - Unit.After = [ - "graphical-session.target" - "niri.service" - ]; - Install.WantedBy = [ "graphical-session.target" ]; - Service = { - ExecStart = "${lib.getExe' (inputs.quickshell.packages.${pkgs.system}.default.override { - withHyprland = false; - withI3 = false; - }) "qs"}"; - }; - }; - -} diff --git a/home/modules/webapps.nix b/home/modules/webapps.nix deleted file mode 100644 index 637a7b7..0000000 --- a/home/modules/webapps.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ config, ... }: -{ - imports = [ - ../util/firefox-webapp.nix - ]; - programs.firefox.webapps = { - "Syncthing" = { - url = "http://127.0.0.1:8384"; - extraSettings = config.programs.firefox.profiles.default.settings; - name = "Syncthing"; - icon = ../icons/syncthing.png; - }; - "Open-WebUI" = { - url = "http://127.0.0.1:8088"; - extraSettings = config.programs.firefox.profiles.default.settings; - name = "Open-WebUI"; - icon = ../icons/openwebui.png; - }; - }; -} diff --git a/home/plank.nix b/home/plank.nix deleted file mode 100644 index f3004de..0000000 --- a/home/plank.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - ... -}: -{ - imports = [ - ./home.nix - ]; - - home = { - username = "plank"; - homeDirectory = "/home/plank"; - }; -} diff --git a/home/programs/kitty.nix b/home/programs/kitty.nix deleted file mode 100644 index aa5c486..0000000 --- a/home/programs/kitty.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ - rice, - ... -}: -let - pal = rice.palette.hex; -in -{ - programs.kitty = { - enable = true; - font = { - inherit (rice.fonts.monospace) name size; - }; - settings = with pal; { - foreground = util.fg; - background = util.bg; - inherit (util) cursor; - cursor_text = util.bg; - selection_foreground = util.fg_sel; - selection_background = util.bg_sel; - color0 = normal.black; - color1 = normal.red; - color2 = normal.green; - color3 = normal.yellow; - color4 = normal.blue; - color5 = normal.magenta; - color6 = normal.cyan; - color7 = normal.white; - color8 = bright.black; - color9 = bright.red; - color10 = bright.green; - color11 = bright.yellow; - color12 = bright.blue; - color13 = bright.magenta; - color14 = bright.cyan; - color15 = bright.white; - sync_to_monitor = "yes"; - shell = "fish"; - cursor_trail = 100; - }; - }; -} diff --git a/home/programs/wlogout.nix b/home/programs/wlogout.nix deleted file mode 100644 index 3721963..0000000 --- a/home/programs/wlogout.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ - rice, - pkgs, - ... -}: -let - pal = rice.palette.hex; -in -{ - programs.wlogout = { - enable = true; - package = pkgs.wleave; - layout = builtins.fromJSON (builtins.readFile ../dots/wlogout/layout); - style = - with pal; - (builtins.replaceStrings - [ - "/usr/share/wlogout" - "/etc/wlogout" - "#WINBG" - "#BTNCOL" - "#BTNBG" - "#BTNFOCUSBG" - "#WINLOGO" - ] - [ - "${pkgs.wlogout}/share/wlogout" - "${pkgs.wlogout}/etc/wlogout" - util.bg - bright.yellow - util.bg - normal.black - (builtins.path { - name = "winlogo"; - path = ../icons/winlogo.png; - sha256 = "7c1ff96b553c7a7ca3a7b7cf8efe830ab7feea92355aed288a10ee7347c24108"; - }) - ] - (builtins.readFile ../dots/wlogout/style.css) - ); - }; - # xdg.configFile = { - # "wleave/layout".text = builtins.readFile ../dots/wlogout/layout; - # "wleave/style.css".text = with palette-hex; (builtins.replaceStrings - # [ - # "/usr/share/wlogout" - # "/etc/wlogout" - # "#WINBG" - # "#BTNCOL" - # "#BTNBG" - # "#BTNFOCUSBG" - # "#WINLOGO" - # ] - # [ - # "${pkgs.wleave}/share/wleave" - # "${pkgs.wleave}/etc/wleave" - # util.bg - # bright.yellow - # util.bg - # normal.black - # (builtins.path { - # name = "winlogo"; - # path = ../icons/winlogo.png; - # sha256 = "7c1ff96b553c7a7ca3a7b7cf8efe830ab7feea92355aed288a10ee7347c24108"; - # }) - # ] - # (builtins.readFile ../dots/wlogout/style.css)); - # }; - - home.packages = [ pkgs.wlogout ]; -} diff --git a/home/util/name.nix b/home/util/name.nix deleted file mode 100644 index 18b1386..0000000 --- a/home/util/name.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - mainUser, - ... -}: -{ - config.home = { - username = mainUser; - homeDirectory = "/home/${mainUser}"; - }; -} diff --git a/hosts/adrift/boot.nix b/hosts/adrift/boot.nix new file mode 100644 index 0000000..c883502 --- /dev/null +++ b/hosts/adrift/boot.nix @@ -0,0 +1,25 @@ +{ ... }: +{ + boot.kernelParams = [ + "mitigations=off" + "quiet" + "loglevel=3" + "systemd.show_status=auto" + "rd.udev.log_level=3" + "vt.global_cursor_default=0" + ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "nvme" + "usb_storage" + "sd_mod" + "rtsx_pci_sdmmc" + ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ + "iwlwifi" + "kvm-intel" + ]; + boot.loader.systemd-boot.configurationLimit = 2; + boot.loader.efi.canTouchEfiVariables = true; +} diff --git a/hosts/adrift/fs.nix b/hosts/adrift/fs.nix new file mode 100644 index 0000000..70cf455 --- /dev/null +++ b/hosts/adrift/fs.nix @@ -0,0 +1,18 @@ +{ ... }: +{ + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/1C5C-8FF4"; + fsType = "vfat"; + }; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/26389642-cf51-4c58-98e9-1fe491a11bb9"; + fsType = "ext4"; + }; + + swapDevices = [ + { device = "/dev/disk/by-uuid/a732641d-1233-45a7-8614-53caed60f11b"; } + ]; + +} diff --git a/hosts/adrift/hw.nix b/hosts/adrift/hw.nix new file mode 100644 index 0000000..3720cce --- /dev/null +++ b/hosts/adrift/hw.nix @@ -0,0 +1,5 @@ +{ lib, config, ... }: +{ + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + services.xserver.videoDrivers = [ "i915" ]; +} diff --git a/hosts/adrift/id.nix b/hosts/adrift/id.nix new file mode 100644 index 0000000..d5efea6 --- /dev/null +++ b/hosts/adrift/id.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + networking.hostName = "adrift"; # Define your hostname. + time.timeZone = "Australia/Sydney"; + time.hardwareClockInLocalTime = false; + i18n.defaultLocale = "en_AU.UTF-8"; + i18n.supportedLocales = [ "en_AU.UTF-8/UTF-8" ]; + nixpkgs.system = "x86_64-linux"; +} diff --git a/hosts/adrift/power.nix b/hosts/adrift/power.nix new file mode 100644 index 0000000..0d839be --- /dev/null +++ b/hosts/adrift/power.nix @@ -0,0 +1,6 @@ +{ lib, ... }: +{ + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + services.power-profiles-daemon.enable = false; + services.tlp.enable = true; +} diff --git a/hosts/quiver/boot.nix b/hosts/quiver/boot.nix new file mode 100644 index 0000000..710becc --- /dev/null +++ b/hosts/quiver/boot.nix @@ -0,0 +1,41 @@ +{ config, ... }: +{ + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "usbcore" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.initrd.verbose = false; + boot.kernelModules = [ + "kvm-amd" + "i2c-dev" + ]; + boot.consoleLogLevel = 0; + boot.kernelParams = [ + "mitigations=off" + "preempt=full" + "quiet" + "loglevel=3" + "systemd.show_status=off" + "rd.udev.log_level=3" + "vt.global_cursor_default=0" + ]; + boot.supportedFilesystems = { + ntfs = true; + btrfs = true; + }; + boot.loader.efi.canTouchEfiVariables = true; + boot.plymouth = { + enable = true; + # theme needs fixing + # inherit (config.rice.plymouth) theme themePackages font; + }; + + boot.loader.limine.extraEntries = '' + /Windows + protocol: efi + path: boot():/EFI/Microsoft/Boot/bootmgfw.efi + ''; +} diff --git a/hosts/quiver/fs.nix b/hosts/quiver/fs.nix new file mode 100644 index 0000000..2b41dbc --- /dev/null +++ b/hosts/quiver/fs.nix @@ -0,0 +1,30 @@ +{ ... }: +{ + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/b993b463-c131-4ef1-9aba-0e3eadaa2f9a"; + fsType = "btrfs"; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/6B75-AF9F"; + fsType = "vfat"; + }; + + "/data" = { + device = "/dev/disk/by-uuid/39D4F78C658E8B56"; + fsType = "ntfs"; + options = [ + "rw" + "uid=1000" + "gid=100" + ]; + }; + }; + + swapDevices = [ + { device = "/dev/disk/by-uuid/9c006925-e0e9-4165-bc0c-508ae2d1bfce"; } + ]; + +} diff --git a/hosts/quiver/hw.nix b/hosts/quiver/hw.nix new file mode 100644 index 0000000..3be5935 --- /dev/null +++ b/hosts/quiver/hw.nix @@ -0,0 +1,37 @@ +{ config, ... }: +{ + + security.tpm2.enable = true; + + hardware.cpu.amd.updateMicrocode = true; + services.xserver.videoDrivers = [ "nvidia" ]; + + nixpkgs.config.cudaSupport = true; + + hardware.nvidia = { + package = config.boot.kernelPackages.nvidiaPackages.latest; + modesetting.enable = true; + powerManagement.enable = true; + nvidiaPersistenced = true; + open = false; + }; + + hardware.graphics.enable = true; + hardware.graphics.enable32Bit = true; + + # openrgb no longer recognises the device? + # systemd.services.no-rgb = { + # wantedBy = ["multi-user.target"]; + # description = "rgb led turn-off-er"; + # serviceConfig = { + # Type = "oneshot"; + # ExecStart = ''${pkgs.openrgb}/bin/openrgb -d "HyperX DRAM" -m static -c 000000''; + # After = ["openrgb"]; + # }; + # }; + + # services.hardware.openrgb = { + # enable = true; + # motherboard = "amd"; + # }; +} diff --git a/system/modules/sydney.nix b/hosts/quiver/id.nix similarity index 71% rename from system/modules/sydney.nix rename to hosts/quiver/id.nix index b04dc0d..c783063 100644 --- a/system/modules/sydney.nix +++ b/hosts/quiver/id.nix @@ -1,6 +1,8 @@ _: { + networking.hostName = "quiver"; time.timeZone = "Australia/Sydney"; time.hardwareClockInLocalTime = false; i18n.defaultLocale = "en_AU.UTF-8"; i18n.supportedLocales = [ "en_AU.UTF-8/UTF-8" ]; + nixpkgs.system = "x86_64-linux"; } diff --git a/hosts/quiver/input.nix b/hosts/quiver/input.nix new file mode 100644 index 0000000..c5e6399 --- /dev/null +++ b/hosts/quiver/input.nix @@ -0,0 +1,13 @@ +{ lib, pkgs, ... }: +{ + hardware.ckb-next.enable = true; + + services.libinput.mouse = { + accelProfile = "flat"; + accelSpeed = 0.0; + }; + + hm.quickServices = { + ckb-next = "${lib.getExe pkgs.ckb-next} -c -b"; + }; +} diff --git a/hosts/quiver/llm.nix b/hosts/quiver/llm.nix new file mode 100644 index 0000000..ff90f78 --- /dev/null +++ b/hosts/quiver/llm.nix @@ -0,0 +1,20 @@ +{ inputs, config, ... }: +{ + services.ollama = { + enable = true; + user = "ollama"; + }; + + services.open-webui = { + package = inputs.nixpkgs-stable.legacyPackages.x86_64-linux.open-webui; + enable = true; + port = 8088; + environment = { + DO_NOT_TRACK = "True"; + SCARF_NO_ANALYTICS = "True"; + ANONYMIZED_TELEMETRY = "False"; + WEBUI_AUTH = "False"; + DATABASE_URL = "sqlite:///${config.services.open-webui.stateDir}/newdb.db"; + }; + }; +} diff --git a/hosts/quiver/outputs.nix b/hosts/quiver/outputs.nix new file mode 100644 index 0000000..421e9b5 --- /dev/null +++ b/hosts/quiver/outputs.nix @@ -0,0 +1,14 @@ +{ ... }: +{ + hm.programs.niri.settings.outputs = { + "DP-1" = { + transform.rotation = 90; + scale = 1; + }; + "DP-2" = { + variable-refresh-rate = true; + scale = 1; + }; + }; + +} diff --git a/hosts/quiver/stateversion.nix b/hosts/quiver/stateversion.nix new file mode 100644 index 0000000..aee74e5 --- /dev/null +++ b/hosts/quiver/stateversion.nix @@ -0,0 +1,5 @@ +{ ... }: +{ + system.stateVersion = "22.11"; + hm.home.stateVersion = "22.11"; +} diff --git a/pkg/fr-yazi.nix b/pkg/fr-yazi.nix new file mode 100644 index 0000000..7a72a91 --- /dev/null +++ b/pkg/fr-yazi.nix @@ -0,0 +1,14 @@ +{ + pkgs, + ... +}: +pkgs.yaziPlugins.mkYaziPlugin { + pname = "fr.yazi"; + version = "dirty-15-07-2025"; + src = pkgs.fetchFromGitHub { + owner = "lpnh"; + repo = "fr.yazi"; + rev = "3d32e55b7367334abaa91f36798ef723098d0a6b"; + hash = "sha256-CrKwFMaiEK+TNW6GRZzyt9MfOmjIb3vw0hBpBXyn16k="; + }; +} diff --git a/rice/gtk-theme.nix b/pkg/gtk-theme.nix similarity index 98% rename from rice/gtk-theme.nix rename to pkg/gtk-theme.nix index 51e3d5f..1ab5d47 100644 --- a/rice/gtk-theme.nix +++ b/pkg/gtk-theme.nix @@ -1,5 +1,4 @@ -{ pkgs }: -{ palette }: +{ pkgs, palette }: let rendersvg = pkgs.runCommand "rendersvg" { } '' mkdir -p $out/bin diff --git a/rice/default.nix b/rice/default.nix deleted file mode 100644 index 2e6c4ce..0000000 --- a/rice/default.nix +++ /dev/null @@ -1,140 +0,0 @@ -{ - inputs, - system, - nix-rice, -}: -let - pkgs = inputs.nixpkgs.legacyPackages.${system}; - inherit (nix-rice) kitty-themes; - inherit (nix-rice.palette) toRGBShortHex toRGBHex; - theme = kitty-themes.parseTheme ./pal.conf; -in -rec { - palette = theme // { - normal = { - black = theme.color0; - red = theme.color1; - green = theme.color2; - yellow = theme.color3; - blue = theme.color4; - magenta = theme.color5; - cyan = theme.color6; - white = theme.color7; - }; - bright = { - black = theme.color8; - red = theme.color9; - green = theme.color10; - yellow = theme.color11; - blue = theme.color12; - magenta = theme.color13; - cyan = theme.color14; - white = theme.color15; - }; - util = { - fg = theme.foreground; - bg = theme.background; - fg_sel = theme.selection_foreground; - bg_sel = theme.selection_background; - inherit (theme) cursor; - # url = theme.url_color; - }; - hex = toRGBHex palette; - shortHex = toRGBShortHex palette; - }; - - fonts = - let - sans = { - name = "Inria Sans"; - size = 12; - package = pkgs.inriafonts; - }; - serif = { - name = "Inria Serif"; - size = 12; - package = pkgs.inriafonts; - }; - monospace = { - name = "Fira Code"; - size = 10; - package = pkgs.fira-code; - }; - emoji = { - name = "Twitter Color Emoji"; - size = 12; - package = pkgs.twemoji-color-font; - }; - in - { - inherit - sans - serif - monospace - emoji - ; - pkgs = [ - sans.package - serif.package - monospace.package - emoji.package - pkgs.meslo-lgs-nf - ]; - }; - - icons = - let - package = pkgs.papirus-icon-theme; - in - { - inherit package; - name = "Papirus-Dark"; - pkgs = [ - package - ]; - }; - - gtk-theme = { - name = "nix-rice"; - package = pkgs.callPackage ./gtk-theme.nix { } { palette = toRGBShortHex palette; }; - }; - - borders = { - thickness = 6; - rounding = 0; - gaps_in = 32; - gaps_out = 72; - }; - - bg = rec { - src = - let - name = "wallpaper.jpg"; - in - builtins.path { - inherit name; - path = ./${name}; - sha256 = "2db3f9d0397fbd4746ada297bd14c0c7d3e22c7d4e894968fcfece90bbfb902a"; - }; - image = pkgs.callPackage ./wallpaper.nix { } { - palette = toRGBShortHex palette; - wallpaper = src; - }; - }; - - cursor = { - package = pkgs.afterglow-cursors-recolored.override { - themeVariants = [ "Dracula" ]; - draculaColorVariants = [ "Orange" ]; - }; - name = "Afterglow-Recolored-Dracula-Orange"; - }; - - plymouth = { - theme = "starship"; - font = "${fonts.sans.package}/share/fonts/truetype/InriaSans-Regular.ttf"; - themePackages = [ - inputs.hudcore.packages.${pkgs.system}.default - ]; - }; -} diff --git a/rice/wallpaper.nix b/rice/wallpaper.nix deleted file mode 100644 index 905edbe..0000000 --- a/rice/wallpaper.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ - pkgs, - lib, - stdenv, - ... -}: -{ - palette, - wallpaper, -}: -let - strPal = - let - inherit (lib) concatStringsSep; - inherit (builtins) foldl' attrValues; - in - concatStringsSep " " ( - foldl' (acc: el: acc ++ (attrValues el)) [ ] [ palette.normal palette.bright palette.util ] - ); -in -stdenv.mkDerivation { - name = "generated-wallpaper.png"; - src = wallpaper; - buildInputs = [ - pkgs.lutgen - ]; - - phases = [ "installPhase" ]; - - installPhase = '' - echo -e "Generating wallpaper from ${wallpaper} using palette:\n${strPal}.." - ${lib.getExe pkgs.lutgen} apply --lum 0.8 -l 10 -s 128 -n 8 -o $out ${wallpaper} -- ${strPal} - ''; -} diff --git a/system/adrift.nix b/system/adrift.nix deleted file mode 100644 index ef09b22..0000000 --- a/system/adrift.nix +++ /dev/null @@ -1,98 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -{ - imports = [ - ./configuration.nix - ]; - - nix.settings.trusted-users = [ "plank" ]; - programs.nh.flake = "/home/plank/.nix"; - - boot.kernelParams = [ - "mitigations=off" - "quiet" - "loglevel=3" - "systemd.show_status=auto" - "rd.udev.log_level=3" - "vt.global_cursor_default=0" - ]; - boot.initrd.availableKernelModules = [ - "xhci_pci" - "nvme" - "usb_storage" - "sd_mod" - "rtsx_pci_sdmmc" - ]; - boot.initrd.kernelModules = [ "dm-snapshot" ]; - boot.kernelModules = [ - "iwlwifi" - "kvm-intel" - ]; - boot.kernelPackages = pkgs.linuxPackages; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/1C5C-8FF4"; - fsType = "vfat"; - }; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/26389642-cf51-4c58-98e9-1fe491a11bb9"; - fsType = "ext4"; - }; - - swapDevices = [ - { device = "/dev/disk/by-uuid/a732641d-1233-45a7-8614-53caed60f11b"; } - ]; - - boot.loader.systemd-boot.configurationLimit = 2; - boot.loader.efi.canTouchEfiVariables = true; - # boot.plymouth.enable = true; - - networking.useDHCP = lib.mkDefault true; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - services.power-profiles-daemon.enable = false; - services.tlp.enable = true; - - environment.sessionVariables = { - NIXOS_OZONE_WL = "1"; - ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=5"; - EDITOR = "hx"; - }; - - virtualisation = { - podman = { - enable = true; - dockerCompat = true; - defaultNetwork.settings.dns_enabled = true; - }; - }; - - services.xserver.videoDrivers = [ "i915" ]; - programs.xwayland.enable = true; - - xdg.portal = { - enable = true; - extraPortals = [ - pkgs.xdg-desktop-portal-gtk - ]; - }; - - environment.systemPackages = builtins.attrValues { - inherit (pkgs) - wl-clipboard - wl-clipboard-x11 - xclip - ; - }; - - networking.hostName = "adrift"; # Define your hostname. - users.users.plank = { - isNormalUser = true; - extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - }; -} diff --git a/system/configuration.nix b/system/configuration.nix deleted file mode 100644 index ca8bc14..0000000 --- a/system/configuration.nix +++ /dev/null @@ -1,99 +0,0 @@ -{ - inputs, - lib, - pkgs, - mainUser, - ... -}: -{ - - imports = [ - ./modules/network.nix - ./modules/term.nix - ./modules/bootloader.nix - ./modules/sound.nix - ./modules/sydney.nix - ./modules/docs.nix - ./modules/nix-meta.nix - ./modules/anal-retentive.nix - ./modules/wm.nix - ./modules/culr.nix - ]; - - nix.gc = { - automatic = true; - dates = "daily"; - persistent = true; - options = "--delete-older-than 14d"; - }; - - services.angrr = { - enable = true; - enableNixGcIntegration = true; - period = "2weeks"; - package = inputs.angrr.packages.${pkgs.system}.default; - }; - - hardware.enableRedistributableFirmware = true; - hardware.enableAllFirmware = true; - - boot.tmp.useTmpfs = true; - - # services.udev.extraHwdb = '' - # evdev:atkbd:* - # KEYBOARD_KEY_3a=esc - # ''; - services.xserver.xkb.options = "caps:swapescape"; - # services.xserver.xkb.extraLayouts."swap" = { - # description = "caps swap"; - # languages = [ "eng" ]; - # symbolsFile = pkgs.writeText "keyboard" '' - # xkb_symbols - # { - # include "us(basic)" - - # key {[ Escape ]}; - # } - # ''; - # }; - console.useXkbConfig = true; - services.libinput.enable = true; - - hardware.graphics.enable = true; - hardware.graphics.enable32Bit = true; - - services.udisks2.enable = true; - - # services.flatpak.enable = true; - - security.polkit.enable = true; - - xdg.autostart.enable = true; - xdg.portal.enable = true; - - # services.tailscale.enable = true; - - # TODO - move these to more appropriate places - environment.systemPackages = builtins.attrValues { - inherit (pkgs) - curl - eza - git - ; - }; - - programs.nix-index-database.comma.enable = true; - programs.nix-index.enableZshIntegration = false; - programs.nix-index.enableBashIntegration = false; - - # gnome/freedesktop compat stuff - programs.dconf.enable = true; - services.gvfs.enable = true; - - # give cpuset to user - systemd.services."user@".serviceConfig.Delegate = "memory pids cpu cpuset"; - - systemd.user.extraConfig = "LogLevel=debug"; - - system.nixos.tags = [ "fatcock-xxl" ]; -} diff --git a/system/modules/anal-retentive.nix b/system/modules/anal-retentive.nix deleted file mode 100644 index cf7c868..0000000 --- a/system/modules/anal-retentive.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - pkgs, - lib, - ... -}: -{ - # perlless activations - boot.initrd.systemd.enable = true; - # breaks everything - # system.etc.overlay = { - # enable = lib.mkDefault true; - # mutable = true; - # }; - services.userborn.enable = lib.mkDefault true; - - # misc perl - system.disableInstallerTools = true; - programs.less.lessopen = null; - programs.command-not-found.enable = false; - boot.enableContainers = false; - boot.loader.grub.enable = false; - environment.defaultPackages = lib.mkDefault [ ]; - documentation.info.enable = false; - - # no cppnix .. ? - # system.systemBuilderArgs.disallowedRequisites = [pkgs.nix]; - nix.package = pkgs.lix; - system.tools.nixos-option.enable = false; -} diff --git a/system/modules/culr.nix b/system/modules/culr.nix deleted file mode 100644 index a27758c..0000000 --- a/system/modules/culr.nix +++ /dev/null @@ -1,6 +0,0 @@ -_: { - programs.culr = { - enable = true; - pattern = "rainbow-split"; - }; -} diff --git a/system/modules/network.nix b/system/modules/network.nix deleted file mode 100644 index bd64ddf..0000000 --- a/system/modules/network.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ ... }: -{ - # imports = [ - # ./mullvad.nix - # ]; - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - systemd.services.NetworkManager-wait-online.enable = true; # for some reason nm doesn't enable without this - services.resolved = { - enable = true; - fallbackDns = [ - "103.1.206.179" - "168.138.8.38" - "168.138.12.137" - ]; - dnssec = "false"; - }; - services.mullvad-vpn.enable = true; - # systemd.services.mullvad-daemon.environment.TALPID_NET_CLS_MOUNT_DIR = "/opt/net-cls-v1"; - networking.firewall = { - checkReversePath = "loose"; - }; -} diff --git a/system/modules/nix-meta.nix b/system/modules/nix-meta.nix deleted file mode 100644 index d7a810b..0000000 --- a/system/modules/nix-meta.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ - pkgs, - lib, - inputs, - mainUser, - ... -}: -{ - # these settings propagate to home-manager's nixpkgs - nixpkgs = { - config = { - allowUnfree = true; - allowUnfreePredicate = _: true; - cudaSupport = true; - }; - }; - - nix = { - # add flake inputs to our registry to allow global use - registry = lib.mapAttrs (_: value: { flake = value; }) inputs; - settings = { - # trusted-users = ["bolt" "plank"]; - experimental-features = [ - "nix-command" - "flakes" - "pipe-operator" - ]; - substitute = true; - }; - extraOptions = '' - keep-outputs = true - keep-derivations = true - ''; - optimise.automatic = true; - # package = pkgs.lix; - }; - - # services.smooooth = { - # enable = true; - # path = "/home/${mainUser}/.nix"; - # blockers = [ - # "hx" - # { - # nix = "die"; - # } - # ]; - # nixPackage = pkgs.lix; - # }; - - programs.meat = { - enable = true; - flake = "/home/${mainUser}/.nix"; - }; - - environment.systemPackages = builtins.attrValues { - inherit (pkgs) - home-manager - cachix - nixfmt-rfc-style - ; - inherit (inputs.nil.packages.${pkgs.system}) nil; - }; -} diff --git a/system/modules/term.nix b/system/modules/term.nix deleted file mode 100644 index a2193e8..0000000 --- a/system/modules/term.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ pkgs, ... }: -let - inherit (pkgs) fish; -in -{ - programs.fish = { - enable = true; - }; - programs.zoxide = { - enable = true; - enableFishIntegration = true; - }; - environment.systemPackages = [ - fish - ]; - environment.shells = [ fish ]; - users.defaultUserShell = fish; - console = { - font = "Lat2-Terminus16"; - }; -} diff --git a/system/modules/wm.nix b/system/modules/wm.nix deleted file mode 100644 index 63486a8..0000000 --- a/system/modules/wm.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - pkgs, - mainUser, - inputs, - ... -}: -{ - services.greetd = { - enable = true; - restart = false; - settings = - let - session = { - command = "niri-session"; - user = "${mainUser}"; - }; - in - { - default_session = session; - initial_session = session; - }; - }; - programs.niri = { - enable = true; - package = inputs.niri.packages.${pkgs.system}.niri-unstable; - }; - services.niri-tag.enable = true; -} diff --git a/system/quiver.nix b/system/quiver.nix deleted file mode 100644 index 2729271..0000000 --- a/system/quiver.nix +++ /dev/null @@ -1,207 +0,0 @@ -{ - config, - lib, - pkgs, - inputs, - rice, - ... -}: -{ - imports = [ - ./configuration.nix - ]; - - environment = { - arbys.enable = true; - files = { - }; - }; - - services.ollama = { - enable = true; - user = "ollama"; - }; - - system.stateVersion = "22.11"; # Did you read the comment? - - networking.hostName = "quiver"; - - users.users.bolt = { - isNormalUser = true; - extraGroups = [ - "wheel" - "podman" - ]; - }; - - boot.initrd.availableKernelModules = [ - "xhci_pci" - "ahci" - "usbcore" - "sd_mod" - ]; - boot.initrd.kernelModules = [ ]; - boot.initrd.verbose = false; - boot.kernelModules = [ - "kvm-amd" - "i2c-dev" - ]; - boot.consoleLogLevel = 0; - boot.kernelParams = [ - "mitigations=off" - "preempt=full" - "quiet" - "loglevel=3" - "systemd.show_status=off" - "rd.udev.log_level=3" - "vt.global_cursor_default=0" - ]; - - services.scx = { - enable = true; - scheduler = "scx_bpfland"; - }; - boot.kernelPackages = pkgs.linuxPackages_cachyos; - boot.supportedFilesystems = { - ntfs = true; - btrfs = true; - }; - - boot.loader.efi.canTouchEfiVariables = true; - - boot.plymouth = { - enable = true; - # inherit (rice.plymouth) theme themePackages font; - }; - - security.tpm2.enable = true; - - networking.useDHCP = lib.mkDefault true; - - hardware.cpu.amd.updateMicrocode = true; - - environment.pathsToLink = [ - "/share/xdg-desktop-portal" - "/share/applications" - ]; - environment.sessionVariables = { - NIXOS_OZONE_WL = "1"; - # ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=5"; - GBM_BACKEND = "nvidia-drm"; - NVD_BACKEND = "direct"; - __GLX_VENDOR_LIBRARY_NAME = "nvidia"; - LIBVA_DRIVER_NAME = "nvidia"; - __GL_GSYNC_ALLOWED = "1"; - __GL_VRR_ALLOWED = "1"; - EDITOR = "hx"; - }; - - nix.settings.trusted-users = [ "bolt" ]; - - virtualisation.oci-containers.backend = "podman"; - hardware.nvidia-container-toolkit.enable = true; - virtualisation = { - podman = { - enable = true; - dockerSocket.enable = true; - defaultNetwork.settings.dns_enabled = true; - }; - }; - - services.xserver.videoDrivers = [ "nvidia" ]; - hardware.nvidia = { - package = config.boot.kernelPackages.nvidiaPackages.latest; - modesetting.enable = true; - powerManagement.enable = true; - nvidiaPersistenced = true; - open = false; - }; - programs.xwayland.enable = true; - - # openrgb no longer recognises the device? - # systemd.services.no-rgb = { - # wantedBy = ["multi-user.target"]; - # description = "rgb led turn-off-er"; - # serviceConfig = { - # Type = "oneshot"; - # ExecStart = ''${pkgs.openrgb}/bin/openrgb -d "HyperX DRAM" -m static -c 000000''; - # After = ["openrgb"]; - # }; - # }; - - # services.hardware.openrgb = { - # enable = true; - # motherboard = "amd"; - # }; - - hardware.ckb-next.enable = true; - environment.systemPackages = - builtins.attrValues { - inherit (pkgs) - wl-clipboard - wl-clipboard-x11 - xclip - ; - inherit (pkgs.kdePackages) qtbase qtdeclarative; - } - ++ [ - (inputs.quickshell.packages.${pkgs.system}.default.override { - withHyprland = false; - withI3 = false; - }) - ]; - programs.fuse.userAllowOther = true; - services.libinput.mouse = { - accelProfile = "flat"; - accelSpeed = 0.0; - }; - - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/b993b463-c131-4ef1-9aba-0e3eadaa2f9a"; - fsType = "btrfs"; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/6B75-AF9F"; - fsType = "vfat"; - }; - - "/data" = { - device = "/dev/disk/by-uuid/39D4F78C658E8B56"; - fsType = "ntfs"; - options = [ - "rw" - "uid=1000" - "gid=100" - ]; - }; - }; - - swapDevices = [ - { device = "/dev/disk/by-uuid/9c006925-e0e9-4165-bc0c-508ae2d1bfce"; } - ]; - - # networking.nftables.enable = true; - networking.firewall = { - # allowedUDPPorts = [1900]; - # allowedTCPPorts = [8200 2234]; - allowedTCPPorts = [ 2234 ]; - }; - - services.open-webui = { - package = inputs.nixpkgs-stable.legacyPackages.x86_64-linux.open-webui; - enable = true; - port = 8088; - environment = { - DO_NOT_TRACK = "True"; - SCARF_NO_ANALYTICS = "True"; - ANONYMIZED_TELEMETRY = "False"; - WEBUI_AUTH = "False"; - DATABASE_URL = "sqlite:///${config.services.open-webui.stateDir}/newdb.db"; - }; - }; - - # for quickshell - qt.enable = true; -} diff --git a/system/servers/atagen-vps/reflector.nix b/system/servers/atagen-vps/reflector.nix deleted file mode 100644 index 585c07d..0000000 --- a/system/servers/atagen-vps/reflector.nix +++ /dev/null @@ -1,361 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). -{ - config, - pkgs, - ... -}: -let - wekan-compose = pkgs.fetchurl { - url = "https://github.com/wekan/wekan/raw/v6.68/docker-compose.yml"; - sha256 = "sha256-gLZ8bZZ8ZMo1NGz3ooIgXRH6JuMoEMp+to7lfqAvc6E="; - }; - # wekan-private = pkgs.runCommand "wekan-private" {} '' - # cp ${wekan-compose} $out - # sed -i '/localtime/d' $out - # sed -i '/timezone/d' $out - # sed -i 's/80:8080/7897:8080/g' $out - # sed -i 's/ROOT_URL=.*/ROOT_URL=https:\/\/reflector\.beam\/kanban\//' $out - # ''; - wekan-rhizome = pkgs.runCommand "wekan-rhizome" { } '' - cp ${wekan-compose} $out - sed -i '/localtime/d' $out - sed -i '/timezone/d' $out - sed -i 's/80:8080/7897:8080/g' $out - sed -i 's/ROOT_URL=.*/ROOT_URL=https:\/\/board\.rhizome\.tf\//' $out - ''; -in -{ - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - # ./cachix.nix - # (import (builtins.fetchTarball "https://github.com/jonascarpay/declarative-cachix/archive/master.tar.gz")) - ]; - - # cachix = [ - # "nix-community" - # ]; - - nix.settings.experimental-features = [ - "flakes" - "nix-command" - ]; - # systemd.services.NetworkManager-wait-online.enable = false; - - # Use the GRUB 2 boot loader. - boot.loader.grub.enable = true; - boot.loader.grub.version = 2; - boot.loader.grub.device = "/dev/vda"; # or "nodev" for efi only - - networking.hostName = "reflector"; # Define your hostname. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - - # Set your time zone. - time.timeZone = "Australia/Sydney"; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.sunshine = { - isNormalUser = true; - extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - packages = with pkgs; [ ]; - openssh.authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDSQC8VgKLzoU5BSynJJuC8BFqAEN8JlSIzsZ2Vg9rfXHM7T4vbWtnxSCSbNw3CEnZCfrdDQTeRum7Uq+gvrcHWd9Aj+rVmubTdud70ybW7T7SlGv3b5TYBhMNbrAz0JIJjLnFMy3/pWids1v6mKW3i7k6Kbq8fSt7jva5Yg5x1jtkUUwvjSZjPg/E/Zl0hAcnx8fWe4foFTcYYsUbfEpp6bxdN2QuVmb17UKnLrMz6JTj88Jd2uYZkeKxGOwk+uwrd0WArY8JIiRi1NcPA3I42aAQfZKxCUY/xmVyRlF+l6K8caD4CZlysms9aXQzBhmPPDIY87AwyRlVK5JsRbaMEBMsffX2xk8DdV+2+9RbztgeXOoYk7WjJX1/+WcxY3RGn8QsUfrGALmrQTRGXgYRbtM/ZJq1m9aP6IvVQeKE1NOpKguXpmokB7JsyKPcWk/PCMVYyXM/qYspc6hRPJgGWiJsayj7myO6X5Ssl9uQnHpNNyrQNY+cx3/boBu2J1sM= bolt@quiver" - ]; - }; - - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - helix - ripgrep - fd - curl - - cachix - headscale - - comma - - woodpecker-agent - woodpecker-server - - # podman - # podman-compose - # shadow - - dufs - ]; - - virtualisation = { - docker.enable = true; - # podman = { - # enable = true; - # dockerCompat = true; - # defaultNetwork.dnsname.enable = true; - # }; - }; - - # services.resolved = { - # enable = true; - # fallbackDns = [ "103.1.206.179" "168.138.8.38" "168.138.12.137" ]; - # dnssec = "false"; - # }; - - services.fail2ban.enable = true; - - services.tailscale.enable = true; - - services.headscale = { - enable = true; - serverUrl = "https://net.atagen.co"; - dns = { - nameservers = [ - "103.1.206.179" - "168.138.8.38" - "168.138.12.137" - ]; - magicDns = true; - }; - }; - - services.syncthing = { - enable = true; - extraOptions = { - gui = { - insecureSkipHostcheck = true; - }; - }; - }; - - services.gitea = { - enable = true; - appName = "atagen gitea"; - domain = "git.atagen.co"; - httpPort = 3033; - settings.server = { - START_SSH_SERVER = true; - SSH_PORT = 6660; - SSH_DOMAIN = "git.atagen.co"; - DISABLE_SSH = false; - }; - rootUrl = "https://git.atagen.co"; - settings.service.DISABLE_REGISTRATION = true; - settings.webhook.ALLOWED_HOST_LIST = "external,loopback"; - }; - - users.users.ci = { - isSystemUser = true; - createHome = true; - group = "ci"; - extraGroups = [ - "docker" - "wheel" - ]; - }; - users.groups.ci = { }; - - users.users.ci-agent = { - isSystemUser = true; - createHome = true; - group = "ci"; - extraGroups = [ - "docker" - "wheel" - ]; - }; - users.groups.ci = { }; - - users.users.dufs = { - isSystemUser = true; - createHome = true; - group = "dufs"; - }; - users.groups.dufs = { }; - - systemd.services.woodpecker-server = { - wantedBy = [ "multi-user.target" ]; - description = "woodpecker CI/CD server"; - serviceConfig = { - Environment = [ - "WOODPECKER_OPEN=true" - "WOODPECKER_ADMIN=atagen" - "WOODPECKER_REPO_OWNERS=rhizome" - "WOODPECKER_HOST=https://ci.atagen.co" - "WOODPECKER_GITEA=true" - "WOODPECKER_GITEA_URL=https://git.atagen.co" - "WOODPECKER_GITEA_CLIENT=1418f1d9-e2ce-4e8f-b8b2-7cf714baa07e" - "WOODPECKER_GITEA_SECRET=gto_chpk65trvfbnrqs4cog62kn7sgmvpizg5wbr4zknb54o4gxlssba" - "WOODPECKER_GITEA_SKIP_VERIFY=true" - "WOODPECKER_AGENT_SECRET=71a0ac7d617aef46fb93811c6e2a300e041a324727df12b4805d5f4e9e1f3326" - "WOODPECKER_DATABASE_DATASOURCE=/var/lib/woodpecker/woodpecker.sqlite" - ]; - Restart = "always"; - ExecStart = "${pkgs.woodpecker-server}/bin/woodpecker-server"; - User = "ci"; - Group = "ci"; - }; - }; - - systemd.services.woodpecker-agent = { - wantedBy = [ "multi-user.target" ]; - description = "woodpecker CI/CD agent"; - serviceConfig = { - Environment = [ - "WOODPECKER_SERVER=localhost:9000" - "WOODPECKER_AGENT_SECRET=71a0ac7d617aef46fb93811c6e2a300e041a324727df12b4805d5f4e9e1f3326" - ]; - Restart = "always"; - ExecStart = "${pkgs.woodpecker-agent}/bin/woodpecker-agent"; - User = "ci-agent"; - }; - }; - - # systemd.services.wekan-private = { - # wantedBy = [ "multi-user.target" ]; - # after = [ "network.target" "docker.service" ]; - # requires = [ "docker.service" ]; - # description = "wekan kanban board"; - # serviceConfig = { - # Restart = "always"; - # User = "root"; - # ExecStart = "${pkgs.docker}/bin/docker compose -f ${wekan-private} up"; - # ExecStop = "${pkgs.docker}/bin/docker compose -f ${wekan-private} down"; - # }; - # }; - - systemd.services.wekan-rhizome = { - wantedBy = [ "multi-user.target" ]; - after = [ - "network.target" - "docker.service" - ]; - requires = [ "docker.service" ]; - description = "wekan kanban board for rhizomers"; - serviceConfig = { - Restart = "always"; - User = "root"; - ExecStart = "${pkgs.docker}/bin/docker compose -f ${wekan-rhizome} up"; - ExecStop = "${pkgs.docker}/bin/docker compose -f ${wekan-rhizome} down"; - }; - }; - - systemd.services.dufs = { - wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; - description = "dufs webdav server"; - serviceConfig = { - User = "dufs"; - Restart = "always"; - ExecStart = "${pkgs.dufs}/bin/dufs -b 127.0.0.1 -p 8083 /home/dufs/files"; - }; - }; - - # systemd.services.foswiki = { - # wantedBy = [ "multi-user.target" ]; - # after = [ "network.target" "docker.service" ]; - # requires = [ "docker.service" ]; - # description = "foswiki wiki site"; - # serviceConfig = { - # Restart = "always"; - # User = "root"; - # ExecStart = "${pkgs.docker}/bin/docker compose -f ${foswiki-compose} up"; - # ExecStop = "${pkgs.docker}/bin/docker compose -f ${foswiki-compose} down"; - # }; - # }; - - services.caddy = { - enable = true; - virtualHosts = { - "atagen.co" = { - serverAliases = [ "www.atagen.co" ]; - extraConfig = '' - respond "i live.. again" - ''; - }; - - "iced-rs.info".extraConfig = '' - reverse_proxy http://127.0.0.1:8765 - ''; - - "ci.atagen.co".extraConfig = '' - reverse_proxy http://127.0.0.1:8000 - ''; - - # "ci.rhizome.tf".extraConfig = '' - # reverse_proxy http://127.0.0.1:8000 - # ''; - - "git.atagen.co".extraConfig = '' - reverse_proxy http://127.0.0.1:3033 - ''; - - # "git.rhizome.tf".extraConfig = '' - # reverse_proxy http://127.0.0.1:3033 - # ''; - - "board.rhizome.tf".extraConfig = '' - reverse_proxy http://127.0.0.1:7897 - ''; - - "net.atagen.co".extraConfig = '' - reverse_proxy http://127.0.0.1:8080 - ''; - - "reflector.beam".extraConfig = '' - tls /etc/selfsigned/cert.pem /etc/selfsigned/key.pem - - route /sync/* { - uri strip_prefix /sync - reverse_proxy http://127.0.0.1:8384 - } - - route /philez/* { - uri strip_prefix /philez - reverse_proxy http://127.0.0.1:8083 - } - ''; - }; - }; - - # Enable the OpenSSH daemon. - services.openssh = { - enable = true; - passwordAuthentication = false; - kbdInteractiveAuthentication = false; - permitRootLogin = "no"; - }; - - networking.firewall = { - enable = true; - trustedInterfaces = [ "tailscale0" ]; - checkReversePath = "loose"; - allowedTCPPorts = [ - 80 - 443 - 6660 - ]; - allowedUDPPorts = [ - 80 - 443 - 41641 - 6660 - ]; - }; - - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - system.copySystemConfiguration = true; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "22.11"; # Did you read the comment? -} diff --git a/system/servers/rhizome-vps/configuration.nix b/system/servers/rhizome-vps/configuration.nix deleted file mode 100644 index 7c65bf0..0000000 --- a/system/servers/rhizome-vps/configuration.nix +++ /dev/null @@ -1,295 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running `nixos-help`). -{ - pkgs, - lib, - ... -}: -{ - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; - nix.extraOptions = '' - keep-outputs = true - keep-derivations = true - ''; - - environment.pathsToLink = [ "/share/zsh" ]; - programs.zsh.enable = true; - users.defaultUserShell = pkgs.zsh; - - users.users.felix = { - isSystemUser = true; - group = "www"; - extraGroups = [ "docker" ]; - }; - - users.users.spore = { - isSystemUser = true; - home = "/home/spore"; - createHome = true; - useDefaultShell = true; - group = "www"; - extraGroups = [ "docker" ]; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL9VRcCnmjCyV7DpCm8ir3+xPTbyMDBJhgSkhpmdFL5d spore@server.rhizome.tf" - ]; - }; - - users.groups.www = { - members = [ - "acme" - "felix" - "spore" - ]; - }; - - boot.loader.grub.enable = true; - boot.loader.grub.device = "/dev/vda"; # or "nodev" for efi only - - networking.hostName = "filament"; # Define your hostname. - time.timeZone = "Australia/Sydney"; - - i18n.defaultLocale = "en_AU.UTF-8"; - - users.users.rhizome = { - isNormalUser = true; - extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - openssh.authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDSQC8VgKLzoU5BSynJJuC8BFqAEN8JlSIzsZ2Vg9rfXHM7T4vbWtnxSCSbNw3CEnZCfrdDQTeRum7Uq+gvrcHWd9Aj+rVmubTdud70ybW7T7SlGv3b5TYBhMNbrAz0JIJjLnFMy3/pWids1v6mKW3i7k6Kbq8fSt7jva5Yg5x1jtkUUwvjSZjPg/E/Zl0hAcnx8fWe4foFTcYYsUbfEpp6bxdN2QuVmb17UKnLrMz6JTj88Jd2uYZkeKxGOwk+uwrd0WArY8JIiRi1NcPA3I42aAQfZKxCUY/xmVyRlF+l6K8caD4CZlysms9aXQzBhmPPDIY87AwyRlVK5JsRbaMEBMsffX2xk8DdV+2+9RbztgeXOoYk7WjJX1/+WcxY3RGn8QsUfrGALmrQTRGXgYRbtM/ZJq1m9aP6IvVQeKE1NOpKguXpmokB7JsyKPcWk/PCMVYyXM/qYspc6hRPJgGWiJsayj7myO6X5Ssl9uQnHpNNyrQNY+cx3/boBu2J1sM= bolt@quiver" - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDW/YjnlHiEf2bV0RapVl+jWEtsNYrbXsaJJhXUkAaf61rsTZ2jpda7FmOVGjyJiOkTNYANoT83YhGxvKt3Ukcx5xG0JhcrilEGKfOR43/QLlXetCh4aFed//CXYNQo8obDovx9A8YamzfZWJo0nhshEAt1aDvNGlyPgHZI3r5vYNB6OpMlaSnr873i5hp6S9dxURoF0FjpdZwTWk5DiYUoZCezs6TfG6PzHbSsB88o4AUNZ6O+h1KD0lITSXH/v/M1zG8fkUzfZHFQoZ6VaIMhIVwLmbybvyb630IIfhx6KUoCWzCRlKBjVOGsQ1xZWEnjPgHB6atX5eNc/L8/bdyZOJ4aE2wSdVNMyriYuiyc3t/RwSvcRpfmzaxWUImDpjH3mxCrDymrZIQQTrNuC6o5O3mz3NCZRcFUZmuZXeYphyrzuNgAfsvHKMd8Fu+PdddSPCHkgYEIRuGD4flaujM8eUHZYqKkpmmiMwKk6jupBscN+1uwBqGQbaR0InXR+4c= custard" - ]; - }; - - users.users.ci = { - isSystemUser = true; - createHome = true; - group = "ci"; - extraGroups = [ "docker" ]; - }; - - users.users.ci-agent = { - isSystemUser = true; - createHome = true; - group = "ci"; - extraGroups = [ "docker" ]; - }; - - users.groups.ci = { }; - - virtualisation = { - docker.enable = true; - # podman = { - # enable = true; - # dockerCompat = true; - # defaultNetwork.settings.dns_enabled = true; - # }; - }; - - services.fail2ban.enable = true; - - services.redis.servers."".enable = true; - - services.gitea = { - enable = true; - appName = "rhizome gitea"; - domain = "git.rhizome.tf"; - httpPort = 3036; - settings.server = { - START_SSH_SERVER = true; - SSH_PORT = 6660; - SSH_DOMAIN = "git.rhizome.tf"; - DISABLE_SSH = false; - }; - rootUrl = "https://git.rhizome.tf"; - settings.service.DISABLE_REGISTRATION = true; - settings.webhook.ALLOWED_HOST_LIST = "external,loopback"; - }; - - # systemd.services.spore = { - # wantedBy = [ "multi-user.target" ]; - # description = "Spore Deployment Tool"; - # serviceConfig = { - # User = "spore"; - # Restart = "on-failure"; - # ExecStart = "${lib.getExe pkgs.spore}"; - - # }; - # }; - - systemd.services.grab-keys = { - description = "Server Key Grabber"; - serviceConfig = { - Type = "oneshot"; - User = "spore"; - Restart = "on-failure"; - ExecStart = "${pkgs.openssh}/bin/scp spore@server.rhizome.tf:/etc/letsencrypt/live/server.rhizome.tf/cert.pem /var/www/server.pem"; - }; - }; - - systemd.timers.grab-keys = { - description = "Server Key Grabber"; - timerConfig = { - Persistent = "yes"; - OnCalendar = "daily"; - Unit = "grab-keys.service"; - }; - }; - - systemd.services.woodpecker-server = { - wantedBy = [ "multi-user.target" ]; - description = "woodpecker CI/CD server"; - serviceConfig = { - Environment = [ - "WOODPECKER_OPEN=true" - "WOODPECKER_ADMIN=dbx" - "WOODPECKER_REPO_OWNERS=rhizome" - "WOODPECKER_HOST=https://ci.rhizome.tf" - "WOODPECKER_GITEA=true" - "WOODPECKER_GITEA_URL=https://git.rhizome.tf" - "WOODPECKER_GITEA_CLIENT=86bb265b-8914-4abd-a3eb-f843fabbd79d" - "WOODPECKER_GITEA_SECRET=gto_474i24aku3vda6wjbumdgfdcjdllclecfplfb4wsz2ibkemhdrwq" - "WOODPECKER_GITEA_SKIP_VERIFY=true" - "WOODPECKER_AGENT_SECRET=71a0ac7d617aef46fb93811c6e2a300e041a324727df12b4805d5f4e9e1f3326" - "WOODPECKER_DATABASE_DATASOURCE=/var/lib/woodpecker/woodpecker.sqlite" - ]; - Restart = "on-failure"; - ExecStart = "${lib.getExe pkgs.woodpecker-server}"; - User = "ci"; - Group = "ci"; - }; - }; - - systemd.services.woodpecker-agent = { - wantedBy = [ "multi-user.target" ]; - description = "woodpecker CI/CD agent"; - serviceConfig = { - Environment = [ - "WOODPECKER_AGENT_SECRET=71a0ac7d617aef46fb93811c6e2a300e041a324727df12b4805d5f4e9e1f3326" - ]; - Restart = "always"; - ExecStart = "${lib.getExe pkgs.woodpecker-agent}"; - User = "ci-agent"; - Group = "ci"; - }; - }; - - systemd.services.felix = { - wantedBy = [ "multi-user.target" ]; - description = "gilles on testing"; - serviceConfig = { - ExecStart = ''${lib.getExe pkgs.docker} run --network host -v /var/lib/acme/rhizome.tf:/var/lib/acme/rhizome.tf --env-file /var/www/felix_env git.rhizome.tf/rhizome/gilles:latest''; - Group = "www"; - User = "felix"; - Restart = "always"; - }; - }; - - services.caddy = { - enable = true; - virtualHosts = { - "rhizome.tf".extraConfig = '' - route /.well-known/acme-challenge/* { - root * /var/www/acme-challenge - file_server - } - root * /var/www/rhizome.tf - file_server - handle_errors { - @404 { - expression {http.error.status_code} == 404 - } - rewrite @404 /404.html - file_server - } - ''; - "git.rhizome.tf".extraConfig = '' - reverse_proxy http://localhost:3036 - ''; - "ci.rhizome.tf".extraConfig = '' - reverse_proxy http://localhost:8000 - ''; - }; - group = "www"; - }; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - kitty - helix - ripgrep - fd - exa - bat - nix-index - comma - alejandra - curl - cachix - git - man-pages - man-pages-posix - rnix-lsp - zellij - zoxide - fzf - btop - ]; - documentation.dev.enable = true; - documentation.man.enable = true; - documentation.enable = true; - programs.nix-index-database.comma.enable = true; - programs.nix-index.enableZshIntegration = false; - programs.nix-index.enableBashIntegration = false; - - services.openssh = { - enable = true; - passwordAuthentication = false; - kbdInteractiveAuthentication = false; - permitRootLogin = "no"; - }; - - networking.firewall.allowedTCPPorts = [ - 22 - 80 - 443 - 5539 - 5559 - 6660 - ]; - networking.firewall.allowedUDPPorts = [ - 443 - 6660 - ]; - - security.acme = { - acceptTerms = true; - defaults.email = "admin@rhizome.tf"; - defaults.group = "www"; - certs."rhizome.tf" = { - webroot = "/var/www/acme-challenge"; - }; - }; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It's perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.05"; # Did you read the comment? - - system.activationScripts = { - acls.text = '' - ${pkgs.acl}/bin/setfacl -Rm spore:rx /var/lib/acme/rhizome.tf - ''; - }; -} diff --git a/system/servers/rhizome-vps/flake.nix b/system/servers/rhizome-vps/flake.nix deleted file mode 100644 index 677b59a..0000000 --- a/system/servers/rhizome-vps/flake.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ - description = "rhizome dev server"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; - - flake-parts = { - url = "github:hercules-ci/flake-parts"; - inputs.nixpkgs-lib.follows = "nixpkgs"; - }; - - flake-utils.url = "github:numtide/flake-utils"; - - home-manager = { - url = "github:nix-community/home-manager/release-23.05"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - nix-index-database = { - url = "github:Mic92/nix-index-database"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - }; - - outputs = - { - self, - nixpkgs, - home-manager, - nix-index-database, - ... - }@inputs: - let - inherit (self) outputs; - in - rec { - nixosConfigurations = { - "filament" = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { inherit inputs outputs; }; - modules = [ - ./configuration.nix - nix-index-database.nixosModules.nix-index - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.extraSpecialArgs = { inherit inputs outputs; }; - home-manager.users.rhizome.imports = [ ./rhizome.nix ]; - } # hm - ]; # modules - }; # filament - }; - }; # rec -} diff --git a/system/servers/rhizome-vps/hardware-configuration.nix b/system/servers/rhizome-vps/hardware-configuration.nix deleted file mode 100644 index 7564564..0000000 --- a/system/servers/rhizome-vps/hardware-configuration.nix +++ /dev/null @@ -1,38 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ - lib, - ... -}: -{ - imports = [ ]; - - boot.initrd.availableKernelModules = [ - "ata_piix" - "uhci_hcd" - "virtio_pci" - "sr_mod" - "virtio_blk" - ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/f4889546-f71c-4e3c-ab47-e183a72dc52e"; - fsType = "ext4"; - }; - - swapDevices = [ ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.ens3.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - virtualisation.hypervGuest.enable = true; -} diff --git a/system/servers/rhizome-vps/rhizome.nix b/system/servers/rhizome-vps/rhizome.nix deleted file mode 100644 index 72acd99..0000000 --- a/system/servers/rhizome-vps/rhizome.nix +++ /dev/null @@ -1,127 +0,0 @@ -{ - pkgs, - ... -}: -{ - home.packages = with pkgs; [ - lazygit - alejandra - ]; - - home = { - username = "rhizome"; - homeDirectory = "/home/rhizome"; - }; - - programs.direnv = { - enable = true; - nix-direnv = { - enable = true; - }; - }; - - programs.git = { - enable = true; - userName = "rhizome"; - userEmail = "filament@rhizome.tf"; - }; - - programs.fzf = { - enable = true; - enableZshIntegration = true; - }; - - programs.helix = { - enable = true; - settings = { - theme = "base16_terminal"; - editor.lsp.display-messages = true; - }; - }; - - programs.zsh = { - enable = true; - enableAutosuggestions = true; - enableCompletion = true; - enableSyntaxHighlighting = true; - enableVteIntegration = true; - autocd = true; - defaultKeymap = "viins"; - initExtra = '' - [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh - alias ...='cd ../..' - alias ....='cd ../../..' - alias .....='cd ../../../..' - alias chmox='chmod +x' - alias gs='git status' - alias gcl='git clone' - alias ga='git add' - alias gcb='git checkout -b' - alias gco='git checkout' - alias gl='git pull' - alias gp='git push' - alias gd='git diff' - alias gcam='git commit -am' - alias gcm='git commit -m' - alias gr='git restore' - alias gm='git merge' - alias l='exa -lh --group-directories-first --icons --color=always' - alias la='exa -lha --group-directories-first --icons --color=always' - eval "$(zoxide init zsh)" - ''; - plugins = [ - { - name = "powerlevel10k"; - src = pkgs.zsh-powerlevel10k; - file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; - } - { - name = "zsh-vi-mode"; - src = pkgs.zsh-vi-mode; - file = "share/zsh-vi-mode/zsh-vi-mode.zsh"; - } - { - name = "zsh-autopair"; - src = pkgs.zsh-autopair; - file = "share/zsh-autopair/zsh-autopair.zsh"; - } - { - name = "zsh-completions"; - src = pkgs.zsh-completions; - file = "share/zsh-completions/zsh-completions.zsh"; - } - { - name = "zsh-command-time"; - src = pkgs.zsh-command-time; - file = "share/zsh-completions/zsh-command-time.zsh"; - } - { - name = "zsh-autocomplete"; - src = pkgs.zsh-autocomplete; - file = "share/zsh-autocomplete/zsh-autocomplete.zsh"; - } - { - name = "zsh-fast-syntax-highlighting"; - src = pkgs.zsh-fast-syntax-highlighting; - file = "share/zsh-fast-syntax-highlighting/zsh-fast-syntax-highlighting.zsh"; - } - { - name = "zsh-nix-shell"; - src = pkgs.zsh-nix-shell; - file = "share/zsh-nix-shell/zsh-nix-shell.zsh"; - } - { - name = "any-nix-shell"; - src = pkgs.any-nix-shell; - file = "share/any-nix-shell/any-nix-shell.zsh"; - } - { - name = "nix-zsh-completions"; - src = pkgs.nix-zsh-completions; - file = "share/nix-zsh-completions/nix-zsh-completions.zsh"; - } - ]; - }; - - home.stateVersion = "23.05"; -} diff --git a/util/create.nix b/util/create.nix new file mode 100644 index 0000000..2c8e43d --- /dev/null +++ b/util/create.nix @@ -0,0 +1,31 @@ +let + inputs = import ./inputs.nix; + inherit (inputs) nixpkgs; + inherit (nixpkgs) lib; + recursivelyImport = import ./recursively-import.nix { inherit lib; }; + recursivePkgs = import ./recursive-pkgs.nix { inherit lib; }; +in +{ + systems = + definitions: + nixpkgs.lib.mapAttrs ( + name: info: + nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + userPkgs = recursivePkgs ../pkg; + mainUser = info.user; + }; + modules = [ + inputs.home-manager.nixosModules.home-manager + (lib.mkAliasOptionModule [ "hm" ] [ "home-manager" "users" info.user ]) + { + home-manager.extraSpecialArgs = { + inherit inputs; + mainUser = info.user; + }; + } + ] ++ (recursivelyImport info.imports); + } + ) definitions; +} diff --git a/util/get-modules.nix b/util/get-modules.nix deleted file mode 100644 index ce5cdeb..0000000 --- a/util/get-modules.nix +++ /dev/null @@ -1,8 +0,0 @@ -inputs: -let - inherit (inputs.nixpkgs.lib) filterAttrs mapAttrsToList; - inherit (builtins) elem; -in -l: -filterAttrs (_: v: elem v l) inputs -|> mapAttrsToList (n: v: v.nixosModules.${n} or v.nixosModules.default) diff --git a/inputs.nix b/util/inputs.nix similarity index 81% rename from inputs.nix rename to util/inputs.nix index 3d9ffdb..c547536 100644 --- a/inputs.nix +++ b/util/inputs.nix @@ -1,5 +1,5 @@ let - lock = builtins.fromJSON (builtins.readFile ./flake.lock); + lock = builtins.fromJSON (builtins.readFile ../flake.lock); node = lock.nodes.root.inputs.__flake-compat; inherit (lock.nodes.${node}.locked) narHash rev url; flake-compat = builtins.fetchTarball { @@ -7,7 +7,7 @@ let sha256 = narHash; }; flake = import flake-compat { - src = ./.; + src = ../.; copySourceTreeToStore = false; useBuiltinsFetchTree = true; }; diff --git a/util/recursive-pkgs.nix b/util/recursive-pkgs.nix new file mode 100644 index 0000000..1b907ac --- /dev/null +++ b/util/recursive-pkgs.nix @@ -0,0 +1,28 @@ +{ lib }: +let + getFiles = + path: + builtins.filter (i: lib.hasSuffix ".nix" (builtins.toString i)) ( + lib.filesystem.listFilesRecursive path + ); + getPkgsAttrs = + path: + let + prefix = builtins.toString path; + in + map ( + file: + let + name = lib.pipe file [ + builtins.toString + (lib.removePrefix (prefix + "/")) + (lib.removeSuffix ".nix") + ]; + in + { + "${name}" = file; + } + ) (getFiles path); + getAllPkgs = path: lib.mergeAttrsList (getPkgsAttrs path); +in +getAllPkgs diff --git a/util/recursively-import.nix b/util/recursively-import.nix new file mode 100644 index 0000000..92b4fc0 --- /dev/null +++ b/util/recursively-import.nix @@ -0,0 +1,21 @@ +{ lib }: +let + recurseIntoFolders = + elem: + if lib.isPath elem && lib.pathIsDirectory elem then + lib.filesystem.listFilesRecursive elem + else + # If it's not a folder, return it unchanged. This handles single-files and + # literal modules (written with {} syntax) + lib.singleton elem; + + filterNixFiles = + paths: + builtins.filter + # filter the files for `.nix` files. if it's not a file, it can stay. + (path: !builtins.isPath path || lib.hasSuffix ".nix" path) + # Expand any folders into all the files within them. Note that this comes + # BEFORE the filtering that's happening above + (builtins.concatMap recurseIntoFolders paths); +in +filterNixFiles