diff --git a/.old/pkgs/bismuth.nix b/.old/pkgs/bismuth.nix index 6fbca6b..5ce74c3 100644 --- a/.old/pkgs/bismuth.nix +++ b/.old/pkgs/bismuth.nix @@ -42,7 +42,7 @@ mkDerivation rec { meta = with lib; { description = "A dynamic tiling extension for KWin"; license = licenses.mit; - maintainers = with maintainers; [pasqui23]; + maintainers = with maintainers; [ pasqui23 ]; homepage = "https://bismuth-forge.github.io/bismuth/"; inherit (kwindowsystem.meta) platforms; }; diff --git a/.old/pkgs/coconut.nix b/.old/pkgs/coconut.nix index 1336500..9c04d27 100644 --- a/.old/pkgs/coconut.nix +++ b/.old/pkgs/coconut.nix @@ -12,35 +12,47 @@ tkinter, watchdog, pkgs, -}: let - pygments = pkgs.python310Packages.callPackage ./pygments.nix {}; +}: +let + pygments = pkgs.python310Packages.callPackage ./pygments.nix { }; in - buildPythonPackage rec { - pname = "coconut"; - version = "3.0.2"; +buildPythonPackage rec { + pname = "coconut"; + version = "3.0.2"; - src = fetchFromGitHub { - owner = "evhub"; - repo = "coconut"; - rev = "v${version}"; - sha256 = lib.fakeSha256; - }; + src = fetchFromGitHub { + owner = "evhub"; + repo = "coconut"; + rev = "v${version}"; + sha256 = lib.fakeSha256; + }; - propagatedBuildInputs = [cpyparsing ipykernel mypy pygments prompt-toolkit watchdog]; + propagatedBuildInputs = [ + cpyparsing + ipykernel + mypy + pygments + prompt-toolkit + watchdog + ]; - checkInputs = [pexpect pytestCheckHook tkinter]; + checkInputs = [ + pexpect + pytestCheckHook + tkinter + ]; - # Currently most tests have performance issues - pytestFlagsArray = [ - "coconut/tests/constants_test.py" - ]; + # Currently most tests have performance issues + pytestFlagsArray = [ + "coconut/tests/constants_test.py" + ]; - pythonImportsCheck = ["coconut"]; + pythonImportsCheck = [ "coconut" ]; - meta = with lib; { - homepage = "http://coconut-lang.org/"; - description = "Simple, elegant, Pythonic functional programming"; - license = licenses.asl20; - maintainers = with maintainers; [fabianhjr]; - }; - } + meta = with lib; { + homepage = "http://coconut-lang.org/"; + description = "Simple, elegant, Pythonic functional programming"; + license = licenses.asl20; + maintainers = with maintainers; [ fabianhjr ]; + }; +} diff --git a/.old/pkgs/culr.nix b/.old/pkgs/culr.nix index 0e689fa..abe41a5 100644 --- a/.old/pkgs/culr.nix +++ b/.old/pkgs/culr.nix @@ -17,8 +17,8 @@ rustPlatform.buildRustPackage rec { sha256 = "sha256-Blo1PyhzKU4LzflmeGrvWOQEon2BCTkF3uQR+7D5/kc="; }; - nativeBuildInputs = [pkg-config]; - buildInputs = [libX11]; + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ libX11 ]; # cargoSha256 = "sha256-Vnhni8tckrexlJ85gfSDEAVWhH6oVHn9/z2O2OIVR5o="; cargoLock = { @@ -32,6 +32,6 @@ rustPlatform.buildRustPackage rec { description = "colourise piped input"; homepage = "https://git.atagen.co/atagen/culr"; license = licenses.mit; - maintainers = []; + maintainers = [ ]; }; } diff --git a/.old/pkgs/default.nix b/.old/pkgs/default.nix index c7292eb..98e8980 100644 --- a/.old/pkgs/default.nix +++ b/.old/pkgs/default.nix @@ -1,6 +1,7 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ # hyprland-system76-scheduler-integration = pkgs.callPackage ./hyprland-system76-scheduler-integration.nix {}; - culr = pkgs.callPackage ./culr.nix {}; + culr = pkgs.callPackage ./culr.nix { }; # eww-git = pkgs.callPackage ./eww.nix {}; # everforest-theme = pkgs.callPackage ./everforst-theme.nix {}; # coconut = pkgs.python310Packages.callPackage ./coconut.nix {}; diff --git a/.old/pkgs/eww.nix b/.old/pkgs/eww.nix index 4f21f23..79b0c08 100644 --- a/.old/pkgs/eww.nix +++ b/.old/pkgs/eww.nix @@ -24,14 +24,20 @@ rustPlatform.buildRustPackage rec { # cargoPatches = [ ./Cargo.lock.patch ]; - nativeBuildInputs = [pkg-config]; + nativeBuildInputs = [ pkg-config ]; - buildInputs = [gtk3 gdk-pixbuf] ++ lib.optional withWayland gtk-layer-shell; + buildInputs = [ + gtk3 + gdk-pixbuf + ] ++ lib.optional withWayland gtk-layer-shell; buildNoDefaultFeatures = withWayland; buildFeatures = lib.optional withWayland "wayland"; - cargoBuildFlags = ["--bin" "eww"]; + cargoBuildFlags = [ + "--bin" + "eww" + ]; cargoTestFlags = cargoBuildFlags; @@ -42,7 +48,10 @@ rustPlatform.buildRustPackage rec { description = "ElKowars wacky widgets"; homepage = "https://github.com/elkowar/eww"; license = licenses.mit; - maintainers = with maintainers; [figsoda lom]; + maintainers = with maintainers; [ + figsoda + lom + ]; broken = stdenv.isDarwin; }; } diff --git a/.old/pkgs/git-credential-keepassxc.nix b/.old/pkgs/git-credential-keepassxc.nix index 9871ad0..91fe591 100644 --- a/.old/pkgs/git-credential-keepassxc.nix +++ b/.old/pkgs/git-credential-keepassxc.nix @@ -20,6 +20,6 @@ rustPlatform.buildRustPackage rec { description = "Helper that allows Git (and shell scripts) to use KeePassXC as credential store"; homepage = "https://github.com/frederick888/git-credential-keepassxc"; license = licenses.gpl3Only; - maintainers = []; + maintainers = [ ]; }; } diff --git a/.old/pkgs/glpaper.nix b/.old/pkgs/glpaper.nix index bde0406..06aef6c 100644 --- a/.old/pkgs/glpaper.nix +++ b/.old/pkgs/glpaper.nix @@ -23,7 +23,11 @@ stdenv.mkDerivation rec { sha256 = "sha256-//IKW2BfpqwcR2WAPShs0kzn5nkV/yyABPvOYm3zMPU="; }; - nativeBuildInputs = [meson ninja pkg-config]; + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; buildInputs = [ wayland libX11 # required by libglvnd @@ -35,6 +39,6 @@ stdenv.mkDerivation rec { homepage = "https://hg.sr.ht/~scoopta/glpaper"; license = licenses.gpl3Plus; platforms = platforms.linux; - maintainers = with maintainers; [ccellado]; + maintainers = with maintainers; [ ccellado ]; }; } diff --git a/.old/pkgs/headscale-ui.nix b/.old/pkgs/headscale-ui.nix index 2f88dd3..1507dde 100644 --- a/.old/pkgs/headscale-ui.nix +++ b/.old/pkgs/headscale-ui.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { sha256 = "sha256-QF10la68Rl2t0K53CH63Qiq54ynkySQACdELorZF/cY="; }; - nativeBuildInputs = [unzip]; + nativeBuildInputs = [ unzip ]; unpackCmd = "unzip headscale-ui.zip"; diff --git a/.old/pkgs/lemurs.nix b/.old/pkgs/lemurs.nix index 6e7395f..ded9d12 100644 --- a/.old/pkgs/lemurs.nix +++ b/.old/pkgs/lemurs.nix @@ -16,8 +16,8 @@ rustPlatform.buildRustPackage rec { sha256 = "sha256-mQXavJULD5iyOnzj72xTV0EQ1HQvj25SHsbDgfRg4lQ="; }; - nativeBuildInputs = [pkg-config]; - buildInputs = [linux-pam]; + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ linux-pam ]; cargoSha256 = "sha256-OCaIeQB8reK0089vbC+4IvQt5pKdZ2SCyyGuQEYWzjo="; @@ -25,6 +25,6 @@ rustPlatform.buildRustPackage rec { description = "A customizable TUI display/login manager written in Rust"; homepage = "https://git.atagen.co/coastalwhite/lemurs"; license = licenses.mit; - maintainers = []; + maintainers = [ ]; }; } diff --git a/.old/pkgs/ly.nix b/.old/pkgs/ly.nix index 7a2b453..4699e88 100644 --- a/.old/pkgs/ly.nix +++ b/.old/pkgs/ly.nix @@ -18,9 +18,12 @@ stdenv.mkDerivation rec { fetchSubmodules = true; }; - nativeBuildInputs = [git]; - buildInputs = [linux-pam libxcb]; - makeFlags = ["FLAGS=-Wno-error=unused-result"]; + nativeBuildInputs = [ git ]; + buildInputs = [ + linux-pam + libxcb + ]; + makeFlags = [ "FLAGS=-Wno-error=unused-result" ]; preBuildPhase = '' mkdir -p ./data @@ -42,6 +45,6 @@ stdenv.mkDerivation rec { description = "TUI display manager"; license = licenses.wtfpl; homepage = "https://github.com/fairyglade/ly"; - maintainers = []; + maintainers = [ ]; }; } diff --git a/.old/pkgs/pygments.nix b/.old/pkgs/pygments.nix index b2bd054..a9a5170 100644 --- a/.old/pkgs/pygments.nix +++ b/.old/pkgs/pygments.nix @@ -6,50 +6,51 @@ lxml, pytestCheckHook, wcag-contrast-ratio, -}: let - pygments = - buildPythonPackage - rec { - pname = "pygments"; - version = "2.15.1"; +}: +let + pygments = buildPythonPackage rec { + pname = "pygments"; + version = "2.15.1"; - src = fetchPypi { - pname = "Pygments"; - inherit version; - sha256 = "sha256-is5NPB3UgYlLIAX1YOrQ+fGe5k/pgzZr4aIeFx0Sd1w="; - }; - - format = "egg"; - - propagatedBuildInputs = [ - docutils - ]; - - # circular dependencies if enabled by default - doCheck = false; - checkInputs = [ - lxml - pytestCheckHook - wcag-contrast-ratio - ]; - - disabledTestPaths = [ - # 5 lines diff, including one nix store path in 20000+ lines - "tests/examplefiles/bash/ltmain.sh" - ]; - - pythonImportsCheck = ["pygments"]; - - passthru.tests = { - check = pygments.overridePythonAttrs (_: {doCheck = true;}); - }; - - meta = with lib; { - homepage = "https://pygments.org/"; - description = "A generic syntax highlighter"; - license = licenses.bsd2; - maintainers = with maintainers; [SuperSandro2000]; - }; + src = fetchPypi { + pname = "Pygments"; + inherit version; + sha256 = "sha256-is5NPB3UgYlLIAX1YOrQ+fGe5k/pgzZr4aIeFx0Sd1w="; }; + + format = "egg"; + + propagatedBuildInputs = [ + docutils + ]; + + # circular dependencies if enabled by default + doCheck = false; + checkInputs = [ + lxml + pytestCheckHook + wcag-contrast-ratio + ]; + + disabledTestPaths = [ + # 5 lines diff, including one nix store path in 20000+ lines + "tests/examplefiles/bash/ltmain.sh" + ]; + + pythonImportsCheck = [ "pygments" ]; + + passthru.tests = { + check = pygments.overridePythonAttrs (_: { + doCheck = true; + }); + }; + + meta = with lib; { + homepage = "https://pygments.org/"; + description = "A generic syntax highlighter"; + license = licenses.bsd2; + maintainers = with maintainers; [ SuperSandro2000 ]; + }; + }; in - pygments +pygments diff --git a/TODO b/TODO index a7e71b0..abc7c3a 100644 --- a/TODO +++ b/TODO @@ -1,23 +1,7 @@ +REPLACE HOME MANAGER WITH +pkgs.writers and HJEM + implement agenix figure out a way to get firefox policies and plugins set up in webapps -concept: -a nixos-like OS with standardised option sets that nonetheless uses composable flake -pieces to construct the whole OS, breaking the monorepo syndrome - -concept: -direnv+flake with services -possibilities: -* flake-containers, but with rootless nspawn? - -* make per project systemd user slice and run services out of it - - can we adapt nixos service modules directly? - - most lightweight option - - can share services between projects by sharing slice - -* roll an oci image and run inside systemd-nspawn - - this allows reuse of the entire nixos module system, - including service config - - docker-like port forwarding - - doesn't fucking work, hates nix oci images, fake and bad diff --git a/flake.lock b/flake.lock index cdfe240..af1f25d 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "cachyos": { + "locked": { + "lastModified": 1737400770, + "narHash": "sha256-m7LBy3Ikj1ZAl2JGXBjLcUykyxybuBfzeATigqkpYVk=", + "owner": "drakon64", + "repo": "nixos-cachyos-kernel", + "rev": "9ee0ce62ad8d2f5364ed6559072331413ce329af", + "type": "github" + }, + "original": { + "owner": "drakon64", + "repo": "nixos-cachyos-kernel", + "type": "github" + } + }, "comfyui": { "inputs": { "comfyui": "comfyui_2", @@ -9,7 +24,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-At2fK3rFdU3oRpXHQN1pGxlV7YHDRhhJtLrYcb70s9w=", + "narHash": "sha256-i6ugvJwvTJ0EgpECbueonyaOdzNXFZOMXkOaVGPoOcQ=", "path": "./flakes/comfyui", "type": "path" }, @@ -29,7 +44,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-onHw7gN3mLi4LTKersFU1aJA+gaUNWlv5WW0hAvAOfg=", + "narHash": "sha256-5/wjRO28BxAijRKtVyQ1+h6q6/IefLqdWWtStzSFONo=", "path": "./flakes/comfyui-plugins", "type": "path" }, @@ -41,11 +56,11 @@ "comfyui_2": { "flake": false, "locked": { - "lastModified": 1735863648, - "narHash": "sha256-hMe8kXco8PTtOeLq0Q2+P3MbcnnShzAlOeCnY1MSuyI=", + "lastModified": 1738409722, + "narHash": "sha256-x9gVw07sPF6SSJE/idOYZVWbJDpDHGr+m77CPd0z+Ho=", "owner": "comfyanonymous", "repo": "ComfyUI", - "rev": "0b9839ef433572609b37d880afb427e4c9ddf151", + "rev": "9e1d301129db2507e6681a83d845186802e4ba22", "type": "github" }, "original": { @@ -56,11 +71,11 @@ }, "crane": { "locked": { - "lastModified": 1727974419, - "narHash": "sha256-WD0//20h+2/yPGkO88d2nYbb23WMWYvnRyDQ9Dx4UHg=", + "lastModified": 1737563566, + "narHash": "sha256-GLJvkOG29XCynQm8XWPyykMRqIhxKcBARVu7Ydrz02M=", "owner": "ipetkov", "repo": "crane", - "rev": "37e4f9f0976cb9281cd3f0c70081e5e0ecaee93f", + "rev": "849376434956794ebc7a6b487d31aace395392ba", "type": "github" }, "original": { @@ -71,11 +86,11 @@ }, "crane_2": { "locked": { - "lastModified": 1734808813, - "narHash": "sha256-3aH/0Y6ajIlfy7j52FGZ+s4icVX0oHhqBzRdlOeztqg=", + "lastModified": 1737689766, + "narHash": "sha256-ivVXYaYlShxYoKfSo5+y5930qMKKJ8CLcAoIBPQfJ6s=", "owner": "ipetkov", "repo": "crane", - "rev": "72e2d02dbac80c8c86bf6bf3e785536acf8ee926", + "rev": "6fe74265bbb6d016d663b1091f015e2976c4a527", "type": "github" }, "original": { @@ -122,6 +137,22 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -163,11 +194,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -230,6 +261,24 @@ "type": "github" } }, + "flake-utils_6": { + "inputs": { + "systems": "systems_7" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "flakey-profile": { "locked": { "lastModified": 1712898590, @@ -248,11 +297,11 @@ "gguf": { "flake": false, "locked": { - "lastModified": 1735245753, - "narHash": "sha256-2o05HLPoFLPwj5zh/B1hHPsfZ9rbfydo/STKPXW1zkM=", + "lastModified": 1736350217, + "narHash": "sha256-3RqFfvXdn9sCIlctqa14c2fvluSmJCR+llfZo/MV64o=", "owner": "city96", "repo": "ComfyUI-GGUF", - "rev": "3dc384b23366983b28222cbf681b808053949a43", + "rev": "5875c52f59baca3a9372d68c43a3775e21846fe0", "type": "github" }, "original": { @@ -312,11 +361,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1735850644, - "narHash": "sha256-9ZvXhg3lG28kgHqd48tW+YJV/6XSLFPCcM7GQnMgj7U=", + "lastModified": 1738463065, + "narHash": "sha256-lQ5MecgzpOLXtt3JfjyRCM9xQ4X3c8yiVNztPMhbCb0=", "owner": "helix-editor", "repo": "helix", - "rev": "4817bfa003163150c9a4553757b4e209e470ecbf", + "rev": "70d452db3e0890e13f8ce9d88b861fa39fb6d95c", "type": "github" }, "original": { @@ -325,6 +374,26 @@ "type": "github" } }, + "hjem": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1737619027, + "narHash": "sha256-jEzZs9dHdmVP5X9HCC/7jrv08aWFfqZV5cZ+cZWYGA4=", + "owner": "feel-co", + "repo": "hjem", + "rev": "48cfa21987672a31a358b7e4d582fc174556e633", + "type": "github" + }, + "original": { + "owner": "feel-co", + "repo": "hjem", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -332,11 +401,11 @@ ] }, "locked": { - "lastModified": 1735774425, - "narHash": "sha256-C73gLFnEh8ZI0uDijUgCDWCd21T6I6tsaWgIBHcfAXg=", + "lastModified": 1738448366, + "narHash": "sha256-4ATtQqBlgsGqkHTemta0ydY6f7JBRXz4Hf574NHQpkg=", "owner": "nix-community", "repo": "home-manager", - "rev": "5f6aa268e419d053c3d5025da740e390b12ac936", + "rev": "18fa9f323d8adbb0b7b8b98a8488db308210ed93", "type": "github" }, "original": { @@ -353,11 +422,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1735832785, - "narHash": "sha256-j/uzZjdGqxA1PFDuByddXzxTWkCTAZIsUSnfEui9BoI=", + "lastModified": 1738370606, + "narHash": "sha256-yIPWsq34x4ebbQVoH0FaP6BJzkrPR9MftKzY+rY5Fqo=", "owner": "JakeStanger", "repo": "ironbar", - "rev": "998e5cecc02a66173e72f0c003a690489cc6ac07", + "rev": "dd36891f5b99c6dce787f63a5cfc47e109cc54e2", "type": "github" }, "original": { @@ -385,11 +454,11 @@ "lix": { "flake": false, "locked": { - "lastModified": 1735572323, - "narHash": "sha256-Wjt+PK15IdaOUoI0sgsRzaNMxKQGSROLe9sOd44+fwM=", - "rev": "5c7ea4f446de58aa64f78087bb4ec26b9c4111aa", + "lastModified": 1738446528, + "narHash": "sha256-NYL/r7EXSyYP7nXuYGvGYMI9QtztGjVaKKofBt/pCv8=", + "rev": "a51380645f61b33d37a536b596d16c481f7b84a6", "type": "tarball", - "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/5c7ea4f446de58aa64f78087bb4ec26b9c4111aa.tar.gz?rev=5c7ea4f446de58aa64f78087bb4ec26b9c4111aa" + "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/a51380645f61b33d37a536b596d16c481f7b84a6.tar.gz?rev=a51380645f61b33d37a536b596d16c481f7b84a6" }, "original": { "type": "tarball", @@ -408,11 +477,11 @@ ] }, "locked": { - "lastModified": 1733522213, - "narHash": "sha256-H+Pk19MzvI/TAbXWimUPZAoKkD56OSyxJBm8lVIA5n0=", - "rev": "c374ebf5548c7b6d4bf884369a5b6879cfc916ea", + "lastModified": 1738176840, + "narHash": "sha256-NG3IRvRs3u3btVCN861FqHvgOwqcNT/Oy6PBG86F5/E=", + "rev": "621aae0f3cceaffa6d73a4fb0f89c08d338d729e", "type": "tarball", - "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/c374ebf5548c7b6d4bf884369a5b6879cfc916ea.tar.gz?rev=c374ebf5548c7b6d4bf884369a5b6879cfc916ea" + "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/621aae0f3cceaffa6d73a4fb0f89c08d338d729e.tar.gz?rev=621aae0f3cceaffa6d73a4fb0f89c08d338d729e" }, "original": { "type": "tarball", @@ -468,11 +537,11 @@ "murex": { "flake": false, "locked": { - "lastModified": 1734814907, - "narHash": "sha256-z3aefJXaymvChmAM9M8c41+1vfw8DxAeRqUxTKfnIOc=", + "lastModified": 1738023202, + "narHash": "sha256-CPjassvyzEI54+s/Dts0h16E956gvAq0H3mbZlqqCMg=", "owner": "lmorg", "repo": "murex", - "rev": "73f172495238b8c8791d6b969f8569a35fb1345d", + "rev": "ac86be87ab04bf4188e7ea85076637494f5afb47", "type": "github" }, "original": { @@ -491,7 +560,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-W/mQRiWXrSxOXEa8gVZwGTkiXheacEGIkRO0g+KYLHQ=", + "narHash": "sha256-H7gJSiSOxLBudoKsLAsE7B+JwFFutiELr6LwAv36BAc=", "path": "./flakes/murex-module-jump", "type": "path" }, @@ -509,7 +578,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-MY6rgMNdy2yGrUUPehzjYnLfFtzHJkt+hzk29nGYyiY=", + "narHash": "sha256-uOr5lrHfnVaNFLaASe0UJ5SEIn5zvGEAjsqFy/f6b2g=", "path": "./flakes/murex-module-starship", "type": "path" }, @@ -523,11 +592,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1733346208, - "narHash": "sha256-a4WZp1xQkrnA4BbnKrzJNr+dYoQr5Xneh2syJoddFyE=", + "lastModified": 1736429655, + "narHash": "sha256-BwMekRuVlSB9C0QgwKMICiJ5EVbLGjfe4qyueyNQyGI=", "owner": "nix-community", "repo": "naersk", - "rev": "378614f37a6bee5a3f2ef4f825a73d948d3ae921", + "rev": "0621e47bd95542b8e1ce2ee2d65d6a1f887a13ce", "type": "github" }, "original": { @@ -541,11 +610,11 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1735816258, - "narHash": "sha256-7zBiXoC43piFocq0wHvNm5KgzolCi3axD4QhWfsw4DU=", + "lastModified": 1737535280, + "narHash": "sha256-gNmu5trAOoWOo1nlSr0i0BOw4AnVmsbI1eG0WjMdvZU=", "owner": "viperML", "repo": "nh", - "rev": "b7a857066e726dafe9c5f00a8af6ab3f25036ee1", + "rev": "245b2a1743a7b7f559d428090630b2b56c25949f", "type": "github" }, "original": { @@ -584,11 +653,11 @@ "xwayland-satellite-unstable": "xwayland-satellite-unstable" }, "locked": { - "lastModified": 1735823072, - "narHash": "sha256-wjTWcLksaiFf+6sB0DPIS2Pyt27oRS/V1qRlDuQf5Qw=", + "lastModified": 1738459562, + "narHash": "sha256-yc31wSweci8ZJhfoIk4GQQ3T8PaYc1F29u9poaN/XnE=", "owner": "sodiboo", "repo": "niri-flake", - "rev": "a8505caae4c8c308e7a954ff4ce5235c8a7ee47c", + "rev": "b195c4f59e460128ce192e1c6aa856011abc2d5f", "type": "github" }, "original": { @@ -600,16 +669,16 @@ "niri-stable": { "flake": false, "locked": { - "lastModified": 1731483594, - "narHash": "sha256-Qjf7alRbPPERfiZsM9EMKX+HwjESky1tieh5PJIkLwE=", + "lastModified": 1736614405, + "narHash": "sha256-AJ1rlgNOPb3/+DbS5hkhm21t6Oz8IgqLllwmZt0lyzk=", "owner": "YaLTeR", "repo": "niri", - "rev": "75c79116a7e40cbc0e110ce0cdd500e896458679", + "rev": "e05bc269e678ecf828b96ae79c991c13b00b38a5", "type": "github" }, "original": { "owner": "YaLTeR", - "ref": "v0.1.10.1", + "ref": "v25.01", "repo": "niri", "type": "github" } @@ -617,11 +686,11 @@ "niri-unstable": { "flake": false, "locked": { - "lastModified": 1735820123, - "narHash": "sha256-PtFFkpsj+dLs/Anj+p3HwvRAPfTvUB6qQhz7WJD/tq0=", + "lastModified": 1738404307, + "narHash": "sha256-BFtfL5kZbIsDAMgbVP5E0HbqDapYWw4NBw1xS0AOCCc=", "owner": "YaLTeR", "repo": "niri", - "rev": "c17d4dc050327c974535369b0b70726b269fd82b", + "rev": "32ad545f842f4c176548e30d183d10e0a2bab752", "type": "github" }, "original": { @@ -635,11 +704,11 @@ "nixpkgs": "nixpkgs_7" }, "locked": { - "lastModified": 1735443188, - "narHash": "sha256-AydPpRBh8+NOkrLylG7vTsHrGO2b5L7XkMEL5HlzcA8=", + "lastModified": 1738466368, + "narHash": "sha256-PZhUjtvQZOH3PO0EYdTpQvcqkgkq1NkP2A6w9SPHYsk=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "55ab1e1df5daf2476e6b826b69a82862dcbd7544", + "rev": "46a8f5fc9552b776bfc5c5c96ea3bede33f68f52", "type": "github" }, "original": { @@ -671,6 +740,26 @@ "type": "github" } }, + "nix-vscode": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_6", + "nixpkgs": "nixpkgs_10" + }, + "locked": { + "lastModified": 1738460950, + "narHash": "sha256-VnojfvmXvLmEddGj+5pGg8UiQY1REHl0apB0R51wylw=", + "owner": "nix-community", + "repo": "nix-vscode-extensions", + "rev": "66dd0a10ed193f204a7e0f9853bdc21f94dd838f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-vscode-extensions", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1728018373, @@ -716,11 +805,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1735669367, - "narHash": "sha256-tfYRbFhMOnYaM4ippqqid3BaLOXoFNdImrfBfCp4zn0=", + "lastModified": 1738277201, + "narHash": "sha256-6L+WXKCw5mqnUIExvqkD99pJQ41xgyCk6z/H9snClwk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "edf04b75c13c2ac0e54df5ec5c543e300f76f1c9", + "rev": "666e1b3f09c267afd66addebe80fb05a5ef2b554", "type": "github" }, "original": { @@ -746,29 +835,29 @@ "type": "github" } }, - "nixpkgs-stable_3": { + "nixpkgs_10": { "locked": { - "lastModified": 1735563628, - "narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=", + "lastModified": 1713805509, + "narHash": "sha256-YgSEan4CcrjivCNO5ZNzhg7/8ViLkZ4CB/GrGBVSudo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798", + "rev": "1e1dc66fe68972a76679644a5577828b6a7e8be4", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-24.05", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs_10": { + "nixpkgs_11": { "locked": { - "lastModified": 1735471104, - "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", + "lastModified": 1738410390, + "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", + "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", "type": "github" }, "original": { @@ -780,11 +869,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1735554305, - "narHash": "sha256-zExSA1i/b+1NMRhGGLtNfFGXgLtgo+dcuzHzaWA6w3Q=", + "lastModified": 1738297584, + "narHash": "sha256-AYvaFBzt8dU0fcSK2jKD0Vg23K2eIRxfsVXIPCW9a0E=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0e82ab234249d8eee3e8c91437802b32c74bb3fd", + "rev": "9189ac18287c599860e878e905da550aa6dec1cd", "type": "github" }, "original": { @@ -794,11 +883,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1735471104, - "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", + "lastModified": 1738142207, + "narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", + "rev": "9d3ae807ebd2981d593cddd0080856873139aa40", "type": "github" }, "original": { @@ -810,11 +899,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1733016324, - "narHash": "sha256-8qwPSE2g1othR1u4uP86NXxm6i7E9nHPyJX3m3lx7Q4=", + "lastModified": 1735563628, + "narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7e1ca67996afd8233d9033edd26e442836cc2ad6", + "rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798", "type": "github" }, "original": { @@ -842,11 +931,11 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1735471104, - "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", + "lastModified": 1738410390, + "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", + "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", "type": "github" }, "original": { @@ -858,11 +947,11 @@ }, "nixpkgs_7": { "locked": { - "lastModified": 1735291276, - "narHash": "sha256-NYVcA06+blsLG6wpAbSPTCyLvxD/92Hy4vlY9WxFI1M=", + "lastModified": 1738410390, + "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "634fd46801442d760e09493a794c4f15db2d0cbb", + "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", "type": "github" }, "original": { @@ -963,10 +1052,12 @@ }, "root": { "inputs": { + "cachyos": "cachyos", "comfyui": "comfyui", "comfyui-plugins": "comfyui-plugins", "culr": "culr", "helix": "helix", + "hjem": "hjem", "home-manager": "home-manager", "ironbar": "ironbar", "lix": "lix", @@ -981,10 +1072,8 @@ "niri": "niri", "nix-index-database": "nix-index-database", "nix-rice": "nix-rice", - "nixpkgs": "nixpkgs_10", - "nixpkgs-stable": "nixpkgs-stable_3", - "rust-overlay": "rust-overlay_4", - "sirula": "sirula" + "nix-vscode": "nix-vscode", + "nixpkgs": "nixpkgs_11" } }, "rust-overlay": { @@ -995,11 +1084,11 @@ ] }, "locked": { - "lastModified": 1728268235, - "narHash": "sha256-lJMFnMO4maJuNO6PQ5fZesrTmglze3UFTTBuKGwR1Nw=", + "lastModified": 1737599167, + "narHash": "sha256-S2rHCrQWCDVp63XxL/AQbGr1g5M8Zx14C7Jooa4oM8o=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "25685cc2c7054efc31351c172ae77b21814f2d42", + "rev": "38374302ae9edf819eac666d1f276d62c712dd06", "type": "github" }, "original": { @@ -1016,11 +1105,11 @@ ] }, "locked": { - "lastModified": 1735612067, - "narHash": "sha256-rsjojgfPUf9tWuMXuuo2KAIoUZ49XGZQJSjFGOO8Cq4=", + "lastModified": 1738290352, + "narHash": "sha256-YKOHUmc0Clm4tMV8grnxYL4IIwtjTayoq/3nqk0QM7k=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "d199142e84bfaae476ffb4e09a70879d7918784d", + "rev": "b031b584125d33d23a0182f91ddbaf3ab4880236", "type": "github" }, "original": { @@ -1050,42 +1139,6 @@ "type": "github" } }, - "rust-overlay_4": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1735871325, - "narHash": "sha256-6Ta5E4mhSfCP6LdkzkG2+BciLOCPeLKuYTJ6lOHW+mI=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "a599f011db521766cbaf7c2f5874182485554f00", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "sirula": { - "flake": false, - "locked": { - "lastModified": 1734194271, - "narHash": "sha256-rBaH2cIIaRoaw8Os60s4MknZywzDuGLagJiAvEYU4m8=", - "owner": "DorianRudolph", - "repo": "sirula", - "rev": "f4da8f5fe50c367e7684334c31ec65fc0fe6997c", - "type": "github" - }, - "original": { - "owner": "DorianRudolph", - "repo": "sirula", - "type": "github" - } - }, "src": { "flake": false, "locked": { @@ -1208,6 +1261,21 @@ "type": "github" } }, + "systems_7": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tensorrt": { "flake": false, "locked": { @@ -1244,11 +1312,11 @@ "xwayland-satellite-unstable": { "flake": false, "locked": { - "lastModified": 1734745564, - "narHash": "sha256-JQNl4pqonVVPQ2JzEOLUcPVRNj//FFFNRDyvQoOkG7s=", + "lastModified": 1737837494, + "narHash": "sha256-wIMowP8Juas4ZwMRcpc+58sZ0kKTDu8fm13THPmv/F8=", "owner": "Supreeeme", "repo": "xwayland-satellite", - "rev": "94da1af75326d89ecb12aba0cc9362e93ffdc766", + "rev": "3944c9a0e40e5629f16ad023bbc90dac80d35a0f", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 2334e0b..b6701be 100644 --- a/flake.nix +++ b/flake.nix @@ -3,20 +3,14 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; - - rust-overlay = { - url = "github:oxalica/rust-overlay"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - helix.url = "github:helix-editor/helix"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + helix.url = "github:helix-editor/helix"; + nix-index-database.url = "github:Mic92/nix-index-database"; nix-rice.url = "github:bertof/nix-rice"; @@ -83,60 +77,61 @@ ironbar.url = "github:JakeStanger/ironbar"; - sirula = { - url = "github:DorianRudolph/sirula"; - flake = false; + nix-vscode.url = "github:nix-community/nix-vscode-extensions"; + + hjem = { + url = "github:feel-co/hjem"; + inputs.nixpkgs.follows = "nixpkgs"; }; - # hjem = { - # url = "github:feel-co/hjem"; - # inputs.nixpkgs.follows = "nixpkgs"; - # }; - - # nixago = { - # url = "github:jmgilman/nixago"; - # inputs.nixpkgs.follows = "nixpkgs"; - # }; - - # wrapper-manager = { - # url = "github:viperML/wrapper-manager"; - # inputs.nixpkgs.follows = "nixpkgs"; - # }; + cachyos.url = "github:drakon64/nixos-cachyos-kernel"; }; - outputs = { - self, - nixpkgs, - home-manager, - nix-index-database, - madness, - meat, - culr, - niri, - ... - } @ inputs: let - inherit (self) outputs; - create = import ./util/create.nix { - inherit nixpkgs home-manager inputs outputs; - system = "x86_64-linux"; - sharedModules = [ - culr.nixosModules.culr - meat.nixosModules.meat - madness.nixosModules.madness - niri.nixosModules.niri - nix-index-database.nixosModules.nix-index - ./system/cachix.nix - ]; - }; - in { - overlays = import ./util/overlay.nix { - inherit inputs; - inherit (nixpkgs) lib; - }; + outputs = + { + self, + nixpkgs, + home-manager, + nix-index-database, + madness, + meat, + culr, + niri, + cachyos, + ... + }@inputs: + let + inherit self; + create = import ./util/create.nix { + inherit + nixpkgs + home-manager + inputs + self + ; + system = "x86_64-linux"; + sharedModules = [ + culr.nixosModules.culr + meat.nixosModules.meat + madness.nixosModules.madness + niri.nixosModules.niri + nix-index-database.nixosModules.nix-index + ./system/cachix.nix + ]; + }; + in + { + overlays = import ./util/overlay.nix { + inherit inputs; + inherit (nixpkgs) lib; + }; - nixosConfigurations = create.systems { - quiver.user = "bolt"; - adrift.user = "plank"; + nixosConfigurations = create.systems { + quiver = { + user = "bolt"; + imports = [ cachyos.nixosModules.default ]; + }; + adrift.user = "plank"; + }; }; - }; } diff --git a/flakes/comfyui-plugins/essentials/default.nix b/flakes/comfyui-plugins/essentials/default.nix index ce8c73c..e8b24ca 100644 --- a/flakes/comfyui-plugins/essentials/default.nix +++ b/flakes/comfyui-plugins/essentials/default.nix @@ -3,19 +3,26 @@ src, python3Packages, ... -}: let - inherit (python3Packages) numba colour-science rembg pixeloe transparent-background; +}: +let + inherit (python3Packages) + numba + colour-science + rembg + pixeloe + transparent-background + ; in - pkgs.stdenvNoCC.mkDerivation { - pname = "comfyui-essentials"; - version = "dev-${builtins.toString src.lastModified}"; - src = src; +pkgs.stdenvNoCC.mkDerivation { + pname = "comfyui-essentials"; + version = "dev-${builtins.toString src.lastModified}"; + inherit src; - propagatedBuildInputs = [ - numba - colour-science - rembg - pixeloe - transparent-background - ]; - } + propagatedBuildInputs = [ + numba + colour-science + rembg + pixeloe + transparent-background + ]; +} diff --git a/flakes/comfyui-plugins/flake.lock b/flakes/comfyui-plugins/flake.lock index 275e8d8..ed0ef70 100644 --- a/flakes/comfyui-plugins/flake.lock +++ b/flakes/comfyui-plugins/flake.lock @@ -3,11 +3,11 @@ "gguf": { "flake": false, "locked": { - "lastModified": 1735245753, - "narHash": "sha256-2o05HLPoFLPwj5zh/B1hHPsfZ9rbfydo/STKPXW1zkM=", + "lastModified": 1736350217, + "narHash": "sha256-3RqFfvXdn9sCIlctqa14c2fvluSmJCR+llfZo/MV64o=", "owner": "city96", "repo": "ComfyUI-GGUF", - "rev": "3dc384b23366983b28222cbf681b808053949a43", + "rev": "5875c52f59baca3a9372d68c43a3775e21846fe0", "type": "github" }, "original": { @@ -18,10 +18,10 @@ }, "nixpkgs": { "locked": { - "lastModified": 1735471104, - "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", - "path": "/nix/store/8vz84mqgnm1gz5yk7hgnnb5gir5hjxas-source", - "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", + "lastModified": 1738410390, + "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", + "path": "/nix/store/hjb1rqv2mfs5ny47amj2gsc8xk05x5g6-source", + "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", "type": "path" }, "original": { diff --git a/flakes/comfyui-plugins/flake.nix b/flakes/comfyui-plugins/flake.nix index 9c92f3b..14c93b8 100644 --- a/flakes/comfyui-plugins/flake.nix +++ b/flakes/comfyui-plugins/flake.nix @@ -22,27 +22,28 @@ }; }; - outputs = { - self, - nixpkgs, - ... - }: let - pkgs = import nixpkgs { - system = "x86_64-linux"; + 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; }; - 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 index 3c45e0f..0d116c7 100644 --- a/flakes/comfyui-plugins/gguf/default.nix +++ b/flakes/comfyui-plugins/gguf/default.nix @@ -3,20 +3,21 @@ src, python3Packages, ... -}: let +}: +let inherit (python3Packages) gguf numpy pyyaml; in - pkgs.stdenvNoCC.mkDerivation { - pname = "comfyui-gguf"; - version = "dev-${builtins.toString src.lastModified}"; - src = src; - propagatedBuildInputs = [ - gguf - numpy - pyyaml - ]; - installPhase = '' - mkdir -p $out - cp -r * $out/ - ''; - } +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/tensorrt/default.nix b/flakes/comfyui-plugins/tensorrt/default.nix index 455ff3e..383a2ac 100644 --- a/flakes/comfyui-plugins/tensorrt/default.nix +++ b/flakes/comfyui-plugins/tensorrt/default.nix @@ -3,21 +3,22 @@ src, python3Packages, ... -}: let +}: +let inherit (python3Packages) tensorrt onnx; in - pkgs.stdenvNoCC.mkDerivation { - pname = "comfyui-tensorrt"; - version = "dev-${builtins.toString src.lastModified}"; - src = src; +pkgs.stdenvNoCC.mkDerivation { + pname = "comfyui-tensorrt"; + version = "dev-${builtins.toString src.lastModified}"; + inherit src; - propagatedBuildInputs = [ - tensorrt - onnx - ]; + propagatedBuildInputs = [ + tensorrt + onnx + ]; - installPhase = '' - mkdir -p $out - cp -r * $out - ''; - } + installPhase = '' + mkdir -p $out + cp -r * $out + ''; +} diff --git a/flakes/comfyui/default.nix b/flakes/comfyui/default.nix index 94b32bf..1d4fb7f 100644 --- a/flakes/comfyui/default.nix +++ b/flakes/comfyui/default.nix @@ -5,12 +5,12 @@ comfyui, comfy_dir ? "/run/user/1000/comfyui/", spandrel, - plugins ? config.comfyui.plugins or [], + plugins ? config.comfyui.plugins or [ ], ... -}: let +}: +let inherit (pkgs) python3; - inherit - (pkgs.python3Packages) + inherit (pkgs.python3Packages) torch torchsde torchvision @@ -31,87 +31,66 @@ ; python = python3.buildEnv.override { - extraLibs = - [ - torch - torchsde - torchvision - torchaudio - einops - transformers - tokenizers - sentencepiece - safetensors - aiohttp - pyyaml - pillow - scipy - tqdm - psutil - kornia - soundfile + extraLibs = [ + torch + torchsde + torchvision + torchaudio + einops + transformers + tokenizers + sentencepiece + safetensors + aiohttp + pyyaml + pillow + scipy + tqdm + psutil + kornia + soundfile - spandrel - ] - ++ plugins; + spandrel + ] ++ plugins; }; - # python = python3.withPackages ( - # ps: - # with ps; [ - # torch - # torchsde - # torchvision - # torchaudio - # einops - # transformers - # tokenizers - # sentencepiece - # safetensors - # aiohttp - # pyyaml - # pillow - # scipy - # tqdm - # psutil - # kornia - # soundfile - # spandrel - # ] - # ); in - pkgs.stdenvNoCC.mkDerivation { - name = "comfyui"; - pname = "comfyui"; - version = "dev-${builtins.toString comfyui.lastModified}"; - src = comfyui; - nativeBuildInputs = let +pkgs.stdenvNoCC.mkDerivation { + name = "comfyui"; + pname = "comfyui"; + version = "dev-${builtins.toString comfyui.lastModified}"; + src = comfyui; + nativeBuildInputs = + let inherit (pkgs) makeWrapper; - in [ + in + [ makeWrapper ]; - propagatedBuildInputs = let + propagatedBuildInputs = + let inherit (pkgs.cudaPackages) cudatoolkit; - in [ + in + [ python cudatoolkit ]; - patches = [./folder_paths.patch]; + 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 '' + 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} + 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"; - } + meta.mainProgram = "comfyui"; +} diff --git a/flakes/comfyui/flake.lock b/flakes/comfyui/flake.lock index 7defbcd..29e6952 100644 --- a/flakes/comfyui/flake.lock +++ b/flakes/comfyui/flake.lock @@ -3,11 +3,11 @@ "comfyui": { "flake": false, "locked": { - "lastModified": 1735863648, - "narHash": "sha256-hMe8kXco8PTtOeLq0Q2+P3MbcnnShzAlOeCnY1MSuyI=", + "lastModified": 1738409722, + "narHash": "sha256-x9gVw07sPF6SSJE/idOYZVWbJDpDHGr+m77CPd0z+Ho=", "owner": "comfyanonymous", "repo": "ComfyUI", - "rev": "0b9839ef433572609b37d880afb427e4c9ddf151", + "rev": "9e1d301129db2507e6681a83d845186802e4ba22", "type": "github" }, "original": { @@ -18,10 +18,10 @@ }, "nixpkgs": { "locked": { - "lastModified": 1735471104, - "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", - "path": "/nix/store/8vz84mqgnm1gz5yk7hgnnb5gir5hjxas-source", - "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", + "lastModified": 1738410390, + "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", + "path": "/nix/store/hjb1rqv2mfs5ny47amj2gsc8xk05x5g6-source", + "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", "type": "path" }, "original": { diff --git a/flakes/comfyui/flake.nix b/flakes/comfyui/flake.nix index 7be3042..25ac064 100644 --- a/flakes/comfyui/flake.nix +++ b/flakes/comfyui/flake.nix @@ -7,42 +7,49 @@ }; nixConfig = { - extra-substituters = ["https://nix-community.cachix.org" "https://cuda-maintainers.cachix.org"]; + 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; + outputs = + { + 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; + 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; + }; }; }; - - 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/module.nix b/flakes/comfyui/module.nix index ff81ee7..1c6f715 100644 --- a/flakes/comfyui/module.nix +++ b/flakes/comfyui/module.nix @@ -3,15 +3,19 @@ lib, config, ... -}: let - inherit (lib) mkEnableOption mkOption types hasSuffix; +}: +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 { + getStorage = if (hasSuffix "/" cfg.storage) then cfg.storage else cfg.storage + "/"; +in +{ options.programs.comfyui = { enable = mkEnableOption "ComfyUI"; storage = mkOption { @@ -21,7 +25,7 @@ in { plugins = mkOption { type = with types; listOf package; description = "list of comfyui plugins"; - default = []; + default = [ ]; }; }; config = lib.mkIf cfg.enable { @@ -29,18 +33,17 @@ in { # pkgs.comfyui (pkgs.comfyui.override { comfy_dir = getStorage; - plugins = cfg.plugins; + inherit (cfg) plugins; }) ]; - home.file = builtins.listToAttrs (map ( - pkg: { - name = "${getStorage}/custom_nodes/${pkg.name}"; - value = { - recursive = true; - source = "${pkg}"; - }; - } - ) - 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 index 0ae7153..7c7d740 100644 --- a/flakes/comfyui/spandrel.nix +++ b/flakes/comfyui/spandrel.nix @@ -1,5 +1,4 @@ { - lib, python3Packages, fetchPypi, ... @@ -14,30 +13,33 @@ python3Packages.buildPythonPackage rec { hash = "sha256-9FUmiT+SOhLvN1QsROREsSCJdlk7x8zfpU/QTHw+gMo="; }; - build-system = let - inherit (python3Packages) setuptools; - in [ - setuptools - ]; + build-system = + let + inherit (python3Packages) setuptools; + in + [ + setuptools + ]; - dependencies = let - inherit - (python3Packages) + dependencies = + let + inherit (python3Packages) + torch + torchvision + safetensors + numpy + einops + typing-extensions + ; + in + [ torch torchvision safetensors numpy einops typing-extensions - ; - in [ - torch - torchvision - safetensors - numpy - einops - typing-extensions - ]; + ]; doCheck = false; } diff --git a/flakes/murex-module-jump/default.nix b/flakes/murex-module-jump/default.nix index 576842c..a3a6ece 100644 --- a/flakes/murex-module-jump/default.nix +++ b/flakes/murex-module-jump/default.nix @@ -1,6 +1,5 @@ { pkgs, - lib, src, ... }: diff --git a/flakes/murex-module-jump/flake.lock b/flakes/murex-module-jump/flake.lock index a06a341..046d557 100644 --- a/flakes/murex-module-jump/flake.lock +++ b/flakes/murex-module-jump/flake.lock @@ -2,10 +2,10 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1735471104, - "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", - "path": "/nix/store/8vz84mqgnm1gz5yk7hgnnb5gir5hjxas-source", - "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", + "lastModified": 1738410390, + "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", + "path": "/nix/store/hjb1rqv2mfs5ny47amj2gsc8xk05x5g6-source", + "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", "type": "path" }, "original": { diff --git a/flakes/murex-module-jump/flake.nix b/flakes/murex-module-jump/flake.nix index 43a5acc..f86ab4e 100644 --- a/flakes/murex-module-jump/flake.nix +++ b/flakes/murex-module-jump/flake.nix @@ -8,16 +8,16 @@ }; }; - outputs = { - self, - nixpkgs, - src, - ... - }: { - overlays.murex-jump = final: _prev: { - murex-jump = final.callPackage ./default.nix { - inherit src; + outputs = + { + src, + ... + }: + { + overlays.murex-jump = final: _prev: { + murex-jump = final.callPackage ./default.nix { + inherit src; + }; }; }; - }; } diff --git a/flakes/murex-module-starship/default.nix b/flakes/murex-module-starship/default.nix index 92e5c60..72ceae4 100644 --- a/flakes/murex-module-starship/default.nix +++ b/flakes/murex-module-starship/default.nix @@ -1,6 +1,5 @@ { pkgs, - lib, src, ... }: diff --git a/flakes/murex-module-starship/flake.lock b/flakes/murex-module-starship/flake.lock index 3a69f1b..97ba082 100644 --- a/flakes/murex-module-starship/flake.lock +++ b/flakes/murex-module-starship/flake.lock @@ -2,10 +2,10 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1735471104, - "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", - "path": "/nix/store/8vz84mqgnm1gz5yk7hgnnb5gir5hjxas-source", - "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", + "lastModified": 1738410390, + "narHash": "sha256-xvTo0Aw0+veek7hvEVLzErmJyQkEcRk6PSR4zsRQFEc=", + "path": "/nix/store/hjb1rqv2mfs5ny47amj2gsc8xk05x5g6-source", + "rev": "3a228057f5b619feb3186e986dbe76278d707b6e", "type": "path" }, "original": { diff --git a/flakes/murex-module-starship/flake.nix b/flakes/murex-module-starship/flake.nix index 2e379be..6b22b96 100644 --- a/flakes/murex-module-starship/flake.nix +++ b/flakes/murex-module-starship/flake.nix @@ -8,16 +8,16 @@ }; }; - outputs = { - self, - nixpkgs, - src, - ... - }: { - overlays.murex-starship = final: _prev: { - murex-starship = final.callPackage ./default.nix { - inherit src; + outputs = + { + src, + ... + }: + { + overlays.murex-starship = final: _prev: { + murex-starship = final.callPackage ./default.nix { + inherit src; + }; }; }; - }; } diff --git a/home/bolt.nix b/home/bolt.nix index 7d9e05f..86eb369 100644 --- a/home/bolt.nix +++ b/home/bolt.nix @@ -1,20 +1,18 @@ { inputs, pkgs, - lib, config, mainUser, ... -}: { +}: +{ inherit mainUser; imports = [ ./home.nix - ./util/local-webapp.nix - ./util/containers.nix + # ./util/local-webapp.nix + # ./util/containers.nix # ./programs/stable-diffusion.nix - # ./programs/openwebui.nix - ./programs/anything-llm.nix inputs.comfyui.homeManagerModules.comfyui ]; @@ -25,13 +23,14 @@ programs.comfyui = { enable = false; storage = "/home/${config.mainUser}/.local/share/comfyui/"; - plugins = []; - # plugins = let - # inherit (pkgs.comfyui-plugins) gguf openpose; - # in [ - # gguf - # # essentials - # openpose - # ]; + plugins = + let + inherit (pkgs.comfyui-plugins) gguf openpose; + in + [ + gguf + # essentials + openpose + ]; }; } diff --git a/home/home.nix b/home/home.nix index eeafffc..2759720 100644 --- a/home/home.nix +++ b/home/home.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let +}: +let inherit (lib) getExe; -in { +in +{ home.stateVersion = "22.11"; imports = [ @@ -29,36 +31,37 @@ in { xdg = { enable = true; - portal = let - gtk = pkgs.xdg-desktop-portal-gtk; - gnome = pkgs.xdg-desktop-portal-gnome; - in { - enable = true; - config = { - common = { - default = [ - "gnome" - ]; + portal = + let + gtk = pkgs.xdg-desktop-portal-gtk; + gnome = pkgs.xdg-desktop-portal-gnome; + in + { + enable = true; + config = { + common = { + default = [ + "gnome" + ]; + }; }; + extraPortals = [ + gnome + gtk + ]; }; - extraPortals = [ - gnome - gtk - ]; - }; }; - home.packages = let - inherit (pkgs.rice) icons fonts cursor; - in - fonts.pkgs - ++ icons.pkgs - ++ [cursor.package]; + home.packages = + let + inherit (pkgs.rice) icons fonts cursor; + in + fonts.pkgs ++ icons.pkgs ++ [ cursor.package ]; systemd.user.targets.tray = { Unit = { Description = "Home Manager System Tray"; - Requires = ["graphical-session.target"]; + Requires = [ "graphical-session.target" ]; }; }; @@ -71,13 +74,13 @@ in { systemd.user.services.udiskie = lib.mkForce { Unit = { Description = "udiskie mount daemon"; - After = []; - PartOf = ["graphical-session.target"]; + After = [ ]; + PartOf = [ "graphical-session.target" ]; }; - Service.ExecStart = ["${pkgs.udiskie}/bin/udiskie --appindicator"]; + Service.ExecStart = [ "${pkgs.udiskie}/bin/udiskie --appindicator" ]; - Install.WantedBy = ["graphical-session.target"]; + Install.WantedBy = [ "graphical-session.target" ]; }; # programs.nix-index-database.comma.enable = true; diff --git a/home/icons/discord.jpg b/home/icons/discord.jpg new file mode 100644 index 0000000..ce94ef4 Binary files /dev/null and b/home/icons/discord.jpg differ diff --git a/home/modules/chat.nix b/home/modules/chat.nix index 54cee7a..4f8062f 100644 --- a/home/modules/chat.nix +++ b/home/modules/chat.nix @@ -1,4 +1,5 @@ -{config, ...}: { +{ config, ... }: +{ imports = [ ../util/firefox-webapp.nix ]; diff --git a/home/modules/cli.nix b/home/modules/cli.nix index e1d8730..c6c10f2 100644 --- a/home/modules/cli.nix +++ b/home/modules/cli.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ imports = [ ../programs/kitty.nix ../programs/zsh.nix diff --git a/home/modules/cosmic.nix b/home/modules/cosmic.nix index defe66a..80da32b 100644 --- a/home/modules/cosmic.nix +++ b/home/modules/cosmic.nix @@ -1,12 +1,13 @@ { - pkgs, lib, ... -}: let +}: +let inherit (lib) range mapAttrsToList; inherit (builtins) toString; workspaceRange = range 1 6; - makeWorkspaceBinding = modifiers: action: + makeWorkspaceBinding = + modifiers: action: map (i: { inherit modifiers; key = toString i; @@ -14,10 +15,9 @@ type = action; data = i; }; - }) - workspaceRange; - focusWsBindings = makeWorkspaceBinding ["Super"] "Workspace"; - moveWsBindings = makeWorkspaceBinding ["Super" "Shift"] "SendToWorkspace"; + }) workspaceRange; + focusWsBindings = makeWorkspaceBinding [ "Super" ] "Workspace"; + moveWsBindings = makeWorkspaceBinding [ "Super" "Shift" ] "SendToWorkspace"; hjkl = { "h" = "Left"; @@ -27,24 +27,18 @@ # "i" = "In"; # "u" = "Out"; }; - makeDirBinding = modifiers: action: - mapAttrsToList ( - key: dir: { - inherit key modifiers; - action = { - type = action; - data = dir; - }; - } - ) - hjkl; - focusBindings = makeDirBinding ["Super"] "Focus"; - moveBindings = makeDirBinding ["Super" "Shift"] "Move"; - winManagementBindings = - focusWsBindings - ++ moveWsBindings - ++ focusBindings - ++ moveBindings; + makeDirBinding = + modifiers: action: + mapAttrsToList (key: dir: { + inherit key modifiers; + action = { + type = action; + data = dir; + }; + }) hjkl; + focusBindings = makeDirBinding [ "Super" ] "Focus"; + moveBindings = makeDirBinding [ "Super" "Shift" ] "Move"; + winManagementBindings = focusWsBindings ++ moveWsBindings ++ focusBindings ++ moveBindings; binding = key: modifiers: action: { inherit key modifiers action; }; @@ -62,97 +56,96 @@ data = action; }; }; -in { +in +{ imports = [ ../util/cosmic.nix ]; config.cosmic = { enable = true; defaultKeybindings = false; - keybindings = - winManagementBindings - ++ [ - # System bindings appear broken? - (binding "q" ["Super" "Shift"] "Close") - (binding "w" ["Super"] "ToggleStacking") - (binding "s" ["Super"] "ToggleOrientation") - (binding "space" ["Super"] "ToggleWindowFloating") - (binding "space" ["Super" "Shift"] "Maximize") - (binding "minus" ["Super"] "Minimize") - (binding "r" ["Super"] { - type = "Resizing"; - data = "Outwards"; - }) - (binding "r" ["Super" "Shift"] { - type = "Resizing"; - data = "Inwards"; - }) - (binding "tab" ["Super"] "NextOutput") - (binding "tab" ["Super" "Shift"] "MoveToNextOutput") - (binding "grave" ["Super"] "PreviousOutput") - (binding "grave" ["Super" "Shift"] "MoveToPreviousOutput") - (spawnBinding "equal" ["Super"] "keepassxc") - (systemBinding "f" ["Super"] "WebBrowser") - # my mime handling is fucked - # (systemBinding "e" ["Super"] "HomeFolder") - # (systemBinding "return" ["Super"] "Terminal") - (spawnBinding "return" ["Super"] "kitty") - # (systemBinding "s" ["Super" "Shift"] "Screenshot") - (systemBinding null ["Super"] "Launcher") - (systemBinding "d" ["Super"] "AppLibrary") - (systemBinding "XF86AudioRaiseVolume" [] "VolumeRaise") - (systemBinding "XF86AudioLowerVolume" [] "VolumeLower") - (systemBinding "XF86AudioMute" [] "Mute") - (spawnBinding "XF86AudioNext" [] "playerctl next") - (spawnBinding "XF86AudioPrev" [] "playerctl previous") - (spawnBinding "XF86AudioPlay" [] "playerctl play-pause") - (spawnBinding "XF86AudioStop" [] "playerctl stop") - (systemBinding "XF86MonBrightnessUp" [] "BrightnessUp") - (systemBinding "XF86MonBrightnessDown" [] "BrightnessDown") - (spawnBinding "e" ["Super" "Shift"] "wlogout") + keybindings = winManagementBindings ++ [ + # System bindings appear broken? + (binding "q" [ "Super" "Shift" ] "Close") + (binding "w" [ "Super" ] "ToggleStacking") + (binding "s" [ "Super" ] "ToggleOrientation") + (binding "space" [ "Super" ] "ToggleWindowFloating") + (binding "space" [ "Super" "Shift" ] "Maximize") + (binding "minus" [ "Super" ] "Minimize") + (binding "r" [ "Super" ] { + type = "Resizing"; + data = "Outwards"; + }) + (binding "r" [ "Super" "Shift" ] { + type = "Resizing"; + data = "Inwards"; + }) + (binding "tab" [ "Super" ] "NextOutput") + (binding "tab" [ "Super" "Shift" ] "MoveToNextOutput") + (binding "grave" [ "Super" ] "PreviousOutput") + (binding "grave" [ "Super" "Shift" ] "MoveToPreviousOutput") + (spawnBinding "equal" [ "Super" ] "keepassxc") + (systemBinding "f" [ "Super" ] "WebBrowser") + # my mime handling is fucked + # (systemBinding "e" ["Super"] "HomeFolder") + # (systemBinding "return" ["Super"] "Terminal") + (spawnBinding "return" [ "Super" ] "kitty") + # (systemBinding "s" ["Super" "Shift"] "Screenshot") + (systemBinding null [ "Super" ] "Launcher") + (systemBinding "d" [ "Super" ] "AppLibrary") + (systemBinding "XF86AudioRaiseVolume" [ ] "VolumeRaise") + (systemBinding "XF86AudioLowerVolume" [ ] "VolumeLower") + (systemBinding "XF86AudioMute" [ ] "Mute") + (spawnBinding "XF86AudioNext" [ ] "playerctl next") + (spawnBinding "XF86AudioPrev" [ ] "playerctl previous") + (spawnBinding "XF86AudioPlay" [ ] "playerctl play-pause") + (spawnBinding "XF86AudioStop" [ ] "playerctl stop") + (systemBinding "XF86MonBrightnessUp" [ ] "BrightnessUp") + (systemBinding "XF86MonBrightnessDown" [ ] "BrightnessDown") + (spawnBinding "e" [ "Super" "Shift" ] "wlogout") - # old, pre-System bindings - # (binding "q" ["Super" "Shift"] "Close") - # (binding "w" ["Super"] "ToggleStacking") - # (binding "s" ["Super"] "ToggleOrientation") - # (binding "space" ["Super"] "ToggleWindowFloating") - # (binding "space" ["Super" "Shift"] "Maximize") - # (binding "minus" ["Super"] "Minimize") - # (binding "r" ["Super"] { - # type = "Resizing"; - # data = "Outwards"; - # }) - # (binding "r" ["Super" "Shift"] { - # type = "Resizing"; - # data = "Inwards"; - # }) - # (binding "tab" ["Super"] "NextOutput") - # (binding "tab" ["Super" "Shift"] "MoveToNextOutput") - # (binding "grave" ["Super"] "PreviousOutput") - # (binding "grave" ["Super" "Shift"] "MoveToPreviousOutput") - # (spawnBinding "f" ["Super"] "firefox") - (spawnBinding "e" ["Super"] "nautilus") - # (spawnBinding "equal" ["Super"] "keepassxc") - # (spawnBinding "return" ["Super"] "kitty") - (spawnBinding "s" ["Super" "Shift"] "cosmic-screenshot") - # (spawnBinding null ["Super"] "cosmic-launcher") - # (spawnBinding "d" ["Super"] "cosmic-app-library") - # (spawnBinding "XF86AudioRaiseVolume" [] "amixer sset Master 5%+") - # (spawnBinding "XF86AudioLowerVolume" [] "amixer sset Master 5%-") - # (spawnBinding "XF86AudioMute" [] "amixer sset Master toggle") - # (spawnBinding "XF86AudioNext" [] "playerctl next") - # (spawnBinding "XF86AudioPrev" [] "playerctl previous") - # (spawnBinding "XF86AudioPlay" [] "playerctl play-pause") - # (spawnBinding "XF86AudioStop" [] "playerctl stop") - # ( - # spawnBinding "XF86MonBrightnessUp" [] - # "busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon IncreaseDisplayBrightness" - # ) - # ( - # spawnBinding "XF86MonBrightnessDown" [] - # "busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon DecreaseDisplayBrightness" - # ) - # (spawnBinding "e" ["Super" "Shift"] "wlogout") - ]; + # old, pre-System bindings + # (binding "q" ["Super" "Shift"] "Close") + # (binding "w" ["Super"] "ToggleStacking") + # (binding "s" ["Super"] "ToggleOrientation") + # (binding "space" ["Super"] "ToggleWindowFloating") + # (binding "space" ["Super" "Shift"] "Maximize") + # (binding "minus" ["Super"] "Minimize") + # (binding "r" ["Super"] { + # type = "Resizing"; + # data = "Outwards"; + # }) + # (binding "r" ["Super" "Shift"] { + # type = "Resizing"; + # data = "Inwards"; + # }) + # (binding "tab" ["Super"] "NextOutput") + # (binding "tab" ["Super" "Shift"] "MoveToNextOutput") + # (binding "grave" ["Super"] "PreviousOutput") + # (binding "grave" ["Super" "Shift"] "MoveToPreviousOutput") + # (spawnBinding "f" ["Super"] "firefox") + (spawnBinding "e" [ "Super" ] "nautilus") + # (spawnBinding "equal" ["Super"] "keepassxc") + # (spawnBinding "return" ["Super"] "kitty") + (spawnBinding "s" [ "Super" "Shift" ] "cosmic-screenshot") + # (spawnBinding null ["Super"] "cosmic-launcher") + # (spawnBinding "d" ["Super"] "cosmic-app-library") + # (spawnBinding "XF86AudioRaiseVolume" [] "amixer sset Master 5%+") + # (spawnBinding "XF86AudioLowerVolume" [] "amixer sset Master 5%-") + # (spawnBinding "XF86AudioMute" [] "amixer sset Master toggle") + # (spawnBinding "XF86AudioNext" [] "playerctl next") + # (spawnBinding "XF86AudioPrev" [] "playerctl previous") + # (spawnBinding "XF86AudioPlay" [] "playerctl play-pause") + # (spawnBinding "XF86AudioStop" [] "playerctl stop") + # ( + # spawnBinding "XF86MonBrightnessUp" [] + # "busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon IncreaseDisplayBrightness" + # ) + # ( + # spawnBinding "XF86MonBrightnessDown" [] + # "busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon DecreaseDisplayBrightness" + # ) + # (spawnBinding "e" ["Super" "Shift"] "wlogout") + ]; }; } diff --git a/home/modules/creative.nix b/home/modules/creative.nix index 2321f10..ac666cd 100644 --- a/home/modules/creative.nix +++ b/home/modules/creative.nix @@ -1,4 +1,5 @@ -{...}: { +_: +{ # imports = [ # ../util/flatpak.nix # ]; diff --git a/home/modules/desktop.nix b/home/modules/desktop.nix index 07e239a..afc4251 100644 --- a/home/modules/desktop.nix +++ b/home/modules/desktop.nix @@ -1,9 +1,10 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ imports = [ ./cosmic.nix ./media-players.nix ./webapps.nix - # ./documents.nix + ./documents.nix # ./creative.nix ./chat.nix ../programs/firefox.nix diff --git a/home/modules/dev.nix b/home/modules/dev.nix index 4cc64e7..e739628 100644 --- a/home/modules/dev.nix +++ b/home/modules/dev.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ imports = [ ../programs/vscode.nix ]; @@ -8,6 +9,47 @@ direnv ]; + programs.zed-editor = { + enable = false; + extensions = [ + "nix" + "rust" + "ocaml" + "kanagawa-themes" + ]; + userSettings = { + features = { + copilot = false; + }; + buffer_font_family = pkgs.rice.fonts.monospace.name; + buffer_font_size = pkgs.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 = { enable = true; nix-direnv = { diff --git a/home/modules/documents.nix b/home/modules/documents.nix index 72145eb..ff0dcf0 100644 --- a/home/modules/documents.nix +++ b/home/modules/documents.nix @@ -1,14 +1,6 @@ -{pkgs, ...}: { - imports = [ - # ../util/flatpak.nix - ]; - # home.packages = with pkgs; [ - # libreoffice - # ]; - flatpaks = [ - # "md.obsidian.Obsidian" - # "com.logseq.Logseq" - # "org.libreoffice.LibreOffice" - # "com.jgraph.drawio.desktop" +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + libreoffice ]; } diff --git a/home/modules/hyprland.nix b/home/modules/hyprland.nix index 909e93a..63037e7 100644 --- a/home/modules/hyprland.nix +++ b/home/modules/hyprland.nix @@ -3,10 +3,12 @@ lib, inputs, ... -}: let - rice = pkgs.rice; +}: +let + inherit (pkgs) rice; palette = pkgs.lib.nix-rice.palette.toRGBShortHex rice.palette; -in { +in +{ programs.hyprlock = { # enable = true; }; @@ -24,23 +26,25 @@ in { package = inputs.hyprland.packages.x86_64-linux.hyprland; systemd = { enable = true; - variables = ["--all"]; + variables = [ "--all" ]; }; settings = { "$mainMod" = "SUPER"; - general = let - inherit (rice.borders) thickness; - inherit (palette) normal; - in { - inherit (rice.borders) gaps_in gaps_out; - border_size = thickness; - layout = "dwindle"; - "col.inactive_border" = "rgb(${normal.black})"; - "col.active_border" = "rgb(${normal.yellow})"; - "col.nogroup_border" = "rgb(${normal.black})"; - "col.nogroup_border_active" = "rgb(${normal.yellow})"; - snap.enabled = true; - }; + general = + let + inherit (rice.borders) thickness; + inherit (palette) normal; + in + { + inherit (rice.borders) gaps_in gaps_out; + border_size = thickness; + layout = "dwindle"; + "col.inactive_border" = "rgb(${normal.black})"; + "col.active_border" = "rgb(${normal.yellow})"; + "col.nogroup_border" = "rgb(${normal.black})"; + "col.nogroup_border_active" = "rgb(${normal.yellow})"; + snap.enabled = true; + }; cursor = { no_hardware_cursors = true; }; @@ -77,16 +81,17 @@ in { "HDMI-A-2, 1920x1080@60, auto-left, 1" "Unknown-1, disable" ]; - bind = let - makeDirBind = bind: extraMods: - lib.mapAttrsToList (key: dir: "$mainMod${extraMods}, ${key}, ${bind}, ${dir}") - { - h = "l"; - j = "d"; - k = "u"; - l = "r"; - }; - in + bind = + let + makeDirBind = + bind: extraMods: + lib.mapAttrsToList (key: dir: "$mainMod${extraMods}, ${key}, ${bind}, ${dir}") { + h = "l"; + j = "d"; + k = "u"; + l = "r"; + }; + in [ "$mainMod, Return, exec, ${lib.getExe pkgs.kitty}" ] diff --git a/home/modules/media-players.nix b/home/modules/media-players.nix index 201cd1f..1b366e6 100644 --- a/home/modules/media-players.nix +++ b/home/modules/media-players.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ home.packages = with pkgs; [ mpv imv diff --git a/home/modules/niri.nix b/home/modules/niri.nix index 62221bc..d48962f 100644 --- a/home/modules/niri.nix +++ b/home/modules/niri.nix @@ -2,160 +2,201 @@ pkgs, lib, config, - inputs, ... -}: let - services = let - inherit (pkgs) swaynotificationcenter sway-audio-idle-inhibit; - in [ - swaynotificationcenter - sway-audio-idle-inhibit - ]; - errata = let - inherit (pkgs) sirula avizo playerctl; - in [ - sirula - avizo - playerctl - ]; - extraServices = let - inherit (pkgs) swayidle swaybg systemd niri-unstable avizo; - in [ - { - name = "swaybg"; - value = "${lib.getExe swaybg} -m fill -i /home/${config.mainUser}/.nix/wallpaper.jpg"; - } - { - name = "avizo-service"; - value = "${lib.getExe' avizo "avizo-service"}"; - } - { - name = "swayidle"; - value = let - lock = lib.getExe pkgs.swaylock; - 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' \ - timeout 599 '${lock} -f' \ - before-sleep '${lock} -f' - ''; - } - ]; -in { +}: +let + services = + let + inherit (pkgs) swaynotificationcenter sway-audio-idle-inhibit; + in + [ + swaynotificationcenter + sway-audio-idle-inhibit + ]; + errata = + let + inherit (pkgs) sirula avizo playerctl; + in + [ + sirula + avizo + playerctl + ]; + extraServices = + let + inherit (pkgs) + swayidle + swaybg + systemd + niri-unstable + avizo + ; + in + [ + { + name = "swaybg"; + value = "${lib.getExe swaybg} -m fill -i /home/${config.mainUser}/.nix/wallpaper.jpg"; + } + { + 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) + name = "${lib.strings.toLower entry.pname}"; + value = "${lib.getExe entry}"; + }) services) ++ extraServices ); - programs.niri.settings = let - inherit (lib) range nameValuePair mapAttrs'; - 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 0 6)); + programs.niri.settings = + let + inherit (lib) range nameValuePair mapAttrs'; + inherit (builtins) listToAttrs replaceStrings; + inherit (config.lib.niri) actions; in - { - "Mod+D".action.spawn = "sirula"; - "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 = "keepassxc"; - "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"]; - } - // makeDirBind "Mod" "focus-window-or-workspace-$DIR" vBinds - // makeDirBind "Mod" "focus-column-or-monitor-$DIR" hBinds - // makeDirBind "Mod+Shift" "move-window-to-workspace-$DIR" vBinds - // 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 - // makeWsBind "Mod" "focus-workspace" - // makeWsBind "Mod+Shift" "move-window-to-workspace"; - outputs = { - "Unknown-1".enable = false; - "DP-1" = { - variable-refresh-rate = true; - scale = 1; + { + 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 0 6) + ); + in + { + "Mod+D".action.spawn = "sirula"; + "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 = "keepassxc"; + "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-or-workspace-$DIR" vBinds + // makeDirBind "Mod" "focus-column-or-monitor-$DIR" hBinds + // makeDirBind "Mod+Shift" "move-window-to-workspace-$DIR" vBinds + // 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 + // makeWsBind "Mod" "focus-workspace" + // makeWsBind "Mod+Shift" "move-window-to-workspace"; + outputs = { + # "Unknown-1".enable = false; + "DP-1" = { + transform.rotation = 90; + scale = 1; + }; + "DP-2" = { + variable-refresh-rate = true; + scale = 1; + }; }; - "HDMI-A-2" = { - transform.rotation = 90; - scale = 1; + input = { + warp-mouse-to-focus = true; }; - }; - input = { - warp-mouse-to-focus = true; - }; - cursor = { - hide-after-inactive-ms = 5000; - hide-when-typing = true; - size = 16; - theme = pkgs.rice.cursor.name; - }; - layout = { - always-center-single-column = true; - gaps = 24; - default-column-width.proportion = 0.5; - preset-column-widths = - map - (p: {proportion = p;}) - [ + cursor = { + hide-after-inactive-ms = 5000; + hide-when-typing = true; + size = 16; + theme = pkgs.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 = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; - in { - active = {color = pal.bright.yellow;}; - inactive = {color = pal.normal.black;}; + focus-ring = + let + pal = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; + in + { + active = { + color = pal.bright.yellow; + }; + inactive = { + color = pal.normal.black; + }; + }; }; + prefer-no-csd = true; + hotkey-overlay.skip-at-startup = true; }; - prefer-no-csd = true; - hotkey-overlay.skip-at-startup = true; - }; - - programs.swaylock = { - enable = true; - settings.color = (pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette).normal.black; - }; programs.ironbar = { enable = true; @@ -178,20 +219,20 @@ in { } ]; end = [ - {type = "clock";} - {type = "tray";} + { type = "clock"; } + { type = "tray"; } ]; }; }; }; systemd.user.services.ironbar = { - Unit.PartOf = ["graphical-session.target"]; + Unit.PartOf = [ "graphical-session.target" ]; Unit.After = [ "graphical-session.target" "niri.service" ]; - Install.WantedBy = ["graphical-session.target"]; + Install.WantedBy = [ "graphical-session.target" ]; }; xdg.configFile = { @@ -211,17 +252,19 @@ in { term_command = "kitty {}" ''; - "sirula/style.css".text = let - pal = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; - in '' - #root-box { - background-color: ${pal.normal.black}; - color: ${pal.normal.yellow}; - font-family: '${pkgs.rice.fonts.sans.name}'; - } - /* what's the name of the highlighted search text? - color: ${pal.normal.white}; - */ - ''; + "sirula/style.css".text = + let + pal = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; + in + '' + #root-box { + background-color: ${pal.normal.black}; + color: ${pal.normal.yellow}; + font-family: '${pkgs.rice.fonts.sans.name}'; + } + /* what's the name of the highlighted search text? + color: ${pal.normal.white}; + */ + ''; }; } diff --git a/home/modules/theming.nix b/home/modules/theming.nix index 7518699..d20388b 100644 --- a/home/modules/theming.nix +++ b/home/modules/theming.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ home.packages = with pkgs; [ gtk-engine-murrine ]; @@ -10,17 +11,19 @@ platformTheme.name = "adwaita"; }; - gtk = with pkgs; - with rice; { - enable = true; - theme = with gtk-theme; { - inherit package name; + gtk = + with pkgs; + with rice; + { + enable = true; + theme = with gtk-theme; { + inherit package name; + }; + iconTheme = with icons; { + inherit package name; + }; + font = with fonts.sans; { + inherit name size package; + }; }; - iconTheme = with icons; { - inherit package name; - }; - font = with fonts.sans; { - inherit name size package; - }; - }; } diff --git a/home/modules/webapps.nix b/home/modules/webapps.nix index 93b2853..637a7b7 100644 --- a/home/modules/webapps.nix +++ b/home/modules/webapps.nix @@ -1,21 +1,20 @@ -{config, ...}: { +{ config, ... }: +{ imports = [ ../util/firefox-webapp.nix ]; programs.firefox.webapps = { "Syncthing" = { url = "http://127.0.0.1:8384"; - # id = 3; extraSettings = config.programs.firefox.profiles.default.settings; name = "Syncthing"; icon = ../icons/syncthing.png; }; - "StudyTAFE" = { - url = "https://www.studytafensw.edu.au"; - # id = 4; + "Open-WebUI" = { + url = "http://127.0.0.1:8088"; extraSettings = config.programs.firefox.profiles.default.settings; - name = "TAFE Study"; - icon = ../icons/tafe.jpg; + name = "Open-WebUI"; + icon = ../icons/openwebui.png; }; }; } diff --git a/home/plank.nix b/home/plank.nix index a760720..f3004de 100644 --- a/home/plank.nix +++ b/home/plank.nix @@ -1,11 +1,7 @@ { - inputs, - outputs, - lib, - config, - pkgs, ... -}: { +}: +{ imports = [ ./home.nix ]; diff --git a/home/programs/anything-llm.nix b/home/programs/anything-llm.nix index 54e7efb..10613f8 100644 --- a/home/programs/anything-llm.nix +++ b/home/programs/anything-llm.nix @@ -2,10 +2,12 @@ lib, config, ... -}: let +}: +let port = 3021; -in { - imports = [./ollama.nix]; +in +{ + imports = [ ./ollama.nix ]; localWebApps = { anything-llm = { @@ -13,43 +15,50 @@ in { genericName = "Chatbot"; icon = ../icons/anythingllm.png; inherit port; - requires.containers = ["anything-llm" "ollama"]; + requires.containers = [ + "anything-llm" + "ollama" + ]; }; }; - services.podman.containers.anything-llm = let - str = builtins.toString; - username = config.mainUser; - in { - image = "docker.io/mintplexlabs/anythingllm"; - devices = ["nvidia.com/gpu=all"]; - ports = ["${str port}:3001"]; - autoStart = false; - autoUpdate = "registry"; - network = ["ollama"]; - volumes = let - home = "/home/${username}"; - share = "${home}/.local/share/anything-llm"; - in [ - "${share}:/app/server/storage" - "${share}/.env:/app/server/.env" - "${share}/config:/home/anythingllm/.config/anythingllm-desktop" - "${share}/config:/home/${username}/.config/anythingllm-desktop" - ]; - environment = { - STORAGE_DIR = "/app/server/storage"; - LLM_PROVIDER = "ollama"; - OLLAMA_BASE_PATH = "http://ollama:11434"; - EMBEDDING_ENGINE = "ollama"; - EMBEDDING_BASE_PATH = "http://ollama:11434"; - VECTOR_DB = "lancedb"; - WHISPER_PROVIDER = "local"; - TTS_PROVIDER = "native"; + services.podman.containers.anything-llm = + let + str = builtins.toString; + username = config.mainUser; + in + { + image = "docker.io/mintplexlabs/anythingllm"; + devices = [ "nvidia.com/gpu=all" ]; + ports = [ "${str port}:3001" ]; + autoStart = false; + autoUpdate = "registry"; + network = [ "ollama" ]; + volumes = + let + home = "/home/${username}"; + share = "${home}/.local/share/anything-llm"; + in + [ + "${share}:/app/server/storage" + "${share}/.env:/app/server/.env" + "${share}/config:/home/anythingllm/.config/anythingllm-desktop" + "${share}/config:/home/${username}/.config/anythingllm-desktop" + ]; + environment = { + STORAGE_DIR = "/app/server/storage"; + LLM_PROVIDER = "ollama"; + OLLAMA_BASE_PATH = "http://ollama:11434"; + EMBEDDING_ENGINE = "ollama"; + EMBEDDING_BASE_PATH = "http://ollama:11434"; + VECTOR_DB = "lancedb"; + WHISPER_PROVIDER = "local"; + TTS_PROVIDER = "native"; + }; + extraConfig.Unit.Requires = [ "podman-ollama.service" ]; + extraPodmanArgs = [ + "--health-cmd" + (lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/3001'") + ]; }; - extraConfig.Unit.Requires = ["podman-ollama.service"]; - extraPodmanArgs = [ - "--health-cmd" - (lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/3001'") - ]; - }; } diff --git a/home/programs/atuin.nix b/home/programs/atuin.nix index 26728ff..215d861 100644 --- a/home/programs/atuin.nix +++ b/home/programs/atuin.nix @@ -1,4 +1,5 @@ -{...}: { +_: +{ programs.atuin = { enable = true; enableZshIntegration = true; diff --git a/home/programs/firefox.nix b/home/programs/firefox.nix index 431e89c..a7e3168 100644 --- a/home/programs/firefox.nix +++ b/home/programs/firefox.nix @@ -1,10 +1,14 @@ { - config, lib, ... -}: let +}: +let officialAddon = name: { - install_url = lib.strings.concatStrings ["https://addons.mozilla.org/firefox/downloads/latest/" name "/latest.xpi"]; + install_url = lib.strings.concatStrings [ + "https://addons.mozilla.org/firefox/downloads/latest/" + name + "/latest.xpi" + ]; installation_mode = "force_installed"; }; lock-false = { @@ -15,7 +19,8 @@ Value = true; Status = "locked"; }; -in { +in +{ programs.firefox = { enable = true; diff --git a/home/programs/helix-ai.nix b/home/programs/helix-ai.nix index 7a08d47..b3a35b3 100644 --- a/home/programs/helix-ai.nix +++ b/home/programs/helix-ai.nix @@ -3,16 +3,19 @@ lib, pkgs, ... -}: let +}: +let palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; - palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette; -in { +in +{ programs.helix = { enable = true; themes = with palette-hex; { nix-rice = { "attribute" = bright.cyan; - "keyword" = {fg = normal.red;}; + "keyword" = { + fg = normal.red; + }; "keyword.directive" = normal.red; "namespace" = bright.cyan; "punctuation" = bright.yellow; @@ -27,29 +30,31 @@ in { "type.builtin" = normal.yellow; "constructor" = { fg = bright.magenta; - modifiers = ["bold"]; + modifiers = [ "bold" ]; }; "function" = { fg = normal.green; - modifiers = ["bold"]; + modifiers = [ "bold" ]; }; "function.macro" = bright.cyan; "function.builtin" = normal.yellow; "tag" = normal.red; "comment" = { fg = normal.magenta; - modifiers = ["italic"]; + modifiers = [ "italic" ]; + }; + "constant" = { + fg = bright.magenta; }; - "constant" = {fg = bright.magenta;}; "constant.builtin" = { fg = bright.magenta; - modifiers = ["bold"]; + modifiers = [ "bold" ]; }; "string" = normal.green; "constant.numeric" = bright.magenta; "constant.character.escape" = { fg = bright.white; - modifiers = ["bold"]; + modifiers = [ "bold" ]; }; "label" = bright.cyan; "module" = bright.cyan; @@ -60,64 +65,86 @@ in { "error" = bright.red; "info" = bright.cyan; "hint" = bright.blue; - "ui.background" = {bg = util.bg;}; - "ui.linenr" = {fg = normal.cyan;}; + "ui.background" = { + inherit (util) bg; + }; + "ui.linenr" = { + fg = normal.cyan; + }; "ui.linenr.selected" = { fg = normal.yellow; - modifiers = ["bold"]; + modifiers = [ "bold" ]; + }; + "ui.cursorline" = { + bg = normal.black; }; - "ui.cursorline" = {bg = normal.black;}; "ui.statusline" = { - fg = util.fg; + inherit (util) fg; bg = bright.black; }; "ui.statusline.normal" = { - fg = util.fg; + inherit (util) fg; bg = bright.black; }; "ui.statusline.insert" = { - fg = util.fg; + inherit (util) fg; bg = normal.blue; }; "ui.statusline.select" = { - fg = util.fg; + inherit (util) fg; bg = bright.yellow; }; "ui.statusline.inactive" = { fg = normal.white; bg = normal.black; }; - "ui.popup" = {bg = normal.black;}; - "ui.window" = {bg = normal.black;}; + "ui.popup" = { + bg = normal.black; + }; + "ui.window" = { + bg = normal.black; + }; "ui.help" = { bg = normal.black; - fg = util.fg; + inherit (util) fg; + }; + "ui.text" = { + inherit (util) fg; + }; + "ui.text.focus" = { + inherit (util) fg; }; - "ui.text" = {fg = util.fg;}; - "ui.text.focus" = {fg = util.fg;}; "ui.selection" = { # modifiers = ["reversed"]; bg = bright.yellow; }; - "ui.selection.primary" = {modifiers = ["reversed"];}; + "ui.selection.primary" = { + modifiers = [ "reversed" ]; + }; # "ui.selection.primary" = { bg = bright.cyan; }; "ui.cursor.primary" = { bg = normal.white; fg = normal.black; }; - "ui.cursor.match" = {bg = bright.cyan;}; + "ui.cursor.match" = { + bg = bright.cyan; + }; "ui.menu" = { - fg = util.fg; + inherit (util) fg; bg = bright.black; }; "ui.menu.selected" = { fg = bright.black; bg = bright.blue; - modifiers = ["bold"]; + modifiers = [ "bold" ]; }; "ui.virtual.whitespace" = bright.black; - "ui.virtual.ruler" = {bg = normal.black;}; - "ui.virtual.inlay-hint" = {fg = normal.magenta;}; + "ui.virtual.ruler" = { + bg = normal.black; + }; + "ui.virtual.inlay-hint" = { + fg = normal.magenta; + }; "diagnostic.warning" = { underline = { color = bright.yellow; @@ -143,12 +170,18 @@ in { }; }; "markup.heading" = bright.cyan; - "markup.bold" = {modifiers = ["bold"];}; - "markup.italic" = {modifiers = ["italic"];}; - "markup.strikethrough" = {modifiers = ["crossed_out"];}; + "markup.bold" = { + modifiers = [ "bold" ]; + }; + "markup.italic" = { + modifiers = [ "italic" ]; + }; + "markup.strikethrough" = { + modifiers = [ "crossed_out" ]; + }; "markup.link.url" = { fg = bright.green; - modifiers = ["underlined"]; + modifiers = [ "underlined" ]; }; "markup.link.text" = bright.red; "markup.raw" = bright.red; @@ -184,17 +217,28 @@ in { normal = "block"; select = "underline"; }; - statusline.left = ["mode" "spinner" "version-control" "file-name" "file-modification-indicator"]; + statusline.left = [ + "mode" + "spinner" + "version-control" + "file-name" + "file-modification-indicator" + ]; lsp.display-messages = true; - keys = let - extend = { - "A-x" = "extend_to_line_bounds"; - "X" = ["extend_line_up" "extend_to_line_bounds"]; + keys = + let + extend = { + "A-x" = "extend_to_line_bounds"; + "X" = [ + "extend_line_up" + "extend_to_line_bounds" + ]; + }; + in + { + normal = extend; + select = extend; }; - in { - normal = extend; - select = extend; - }; }; }; @@ -202,13 +246,19 @@ in { language = [ { name = "rust"; - language-servers = ["rust-analyzer" "lsp-ai"]; + language-servers = [ + "rust-analyzer" + "lsp-ai" + ]; auto-format = true; } { name = "nix"; - language-servers = ["nixd" "lsp-ai"]; - file-types = ["nix"]; + language-servers = [ + "nixd" + "lsp-ai" + ]; + file-types = [ "nix" ]; # auto-format = true; formatter = { command = "alejandra"; @@ -216,8 +266,14 @@ in { } { name = "ocaml"; - language-servers = ["ocamllsp" "lsp-ai"]; - file-types = ["ml" "mli"]; + language-servers = [ + "ocamllsp" + "lsp-ai" + ]; + file-types = [ + "ml" + "mli" + ]; auto-format = true; formatter = { command = "ocamlformat"; @@ -233,7 +289,7 @@ in { lsp-ai = { command = "lsp-ai"; config = { - memory.fileStore = {}; + memory.fileStore = { }; models = { llama32 = { type = "ollama"; @@ -285,7 +341,7 @@ in { }; }; }; - }; #language-server - }; #languages - }; #helix config + }; # language-server + }; # languages + }; # helix config } diff --git a/home/programs/helix.nix b/home/programs/helix.nix index a2e814c..8a5fbe9 100644 --- a/home/programs/helix.nix +++ b/home/programs/helix.nix @@ -3,16 +3,19 @@ lib, pkgs, ... -}: let +}: +let palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; - palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette; -in { +in +{ programs.helix = { enable = true; themes = with palette-hex; { nix-rice = { "attribute" = bright.cyan; - "keyword" = {fg = normal.red;}; + "keyword" = { + fg = normal.red; + }; "keyword.directive" = normal.red; "namespace" = bright.cyan; "punctuation" = bright.yellow; @@ -27,29 +30,31 @@ in { "type.builtin" = normal.yellow; "constructor" = { fg = bright.magenta; - modifiers = ["bold"]; + modifiers = [ "bold" ]; }; "function" = { fg = normal.green; - modifiers = ["bold"]; + modifiers = [ "bold" ]; }; "function.macro" = bright.cyan; "function.builtin" = normal.yellow; "tag" = normal.red; "comment" = { fg = normal.magenta; - modifiers = ["italic"]; + modifiers = [ "italic" ]; + }; + "constant" = { + fg = bright.magenta; }; - "constant" = {fg = bright.magenta;}; "constant.builtin" = { fg = bright.magenta; - modifiers = ["bold"]; + modifiers = [ "bold" ]; }; "string" = normal.green; "constant.numeric" = bright.magenta; "constant.character.escape" = { fg = bright.white; - modifiers = ["bold"]; + modifiers = [ "bold" ]; }; "label" = bright.cyan; "module" = bright.cyan; @@ -60,64 +65,86 @@ in { "error" = bright.red; "info" = bright.cyan; "hint" = bright.blue; - "ui.background" = {bg = util.bg;}; - "ui.linenr" = {fg = normal.cyan;}; + "ui.background" = { + inherit (util) bg; + }; + "ui.linenr" = { + fg = normal.cyan; + }; "ui.linenr.selected" = { fg = normal.yellow; - modifiers = ["bold"]; + modifiers = [ "bold" ]; + }; + "ui.cursorline" = { + bg = normal.black; }; - "ui.cursorline" = {bg = normal.black;}; "ui.statusline" = { - fg = util.fg; + inherit (util) fg; bg = bright.black; }; "ui.statusline.normal" = { - fg = util.fg; + inherit (util) fg; bg = bright.black; }; "ui.statusline.insert" = { - fg = util.fg; + inherit (util) fg; bg = normal.blue; }; "ui.statusline.select" = { - fg = util.fg; + inherit (util) fg; bg = bright.yellow; }; "ui.statusline.inactive" = { fg = normal.white; bg = normal.black; }; - "ui.popup" = {bg = normal.black;}; - "ui.window" = {bg = normal.black;}; + "ui.popup" = { + bg = normal.black; + }; + "ui.window" = { + bg = normal.black; + }; "ui.help" = { bg = normal.black; - fg = util.fg; + inherit (util) fg; + }; + "ui.text" = { + inherit (util) fg; + }; + "ui.text.focus" = { + inherit (util) fg; }; - "ui.text" = {fg = util.fg;}; - "ui.text.focus" = {fg = util.fg;}; "ui.selection" = { # modifiers = ["reversed"]; bg = bright.yellow; }; - "ui.selection.primary" = {modifiers = ["reversed"];}; + "ui.selection.primary" = { + modifiers = [ "reversed" ]; + }; # "ui.selection.primary" = { bg = bright.cyan; }; "ui.cursor.primary" = { bg = normal.white; fg = normal.black; }; - "ui.cursor.match" = {bg = bright.cyan;}; + "ui.cursor.match" = { + bg = bright.cyan; + }; "ui.menu" = { - fg = util.fg; + inherit (util) fg; bg = bright.black; }; "ui.menu.selected" = { fg = bright.black; bg = bright.blue; - modifiers = ["bold"]; + modifiers = [ "bold" ]; }; "ui.virtual.whitespace" = bright.black; - "ui.virtual.ruler" = {bg = normal.black;}; - "ui.virtual.inlay-hint" = {fg = normal.magenta;}; + "ui.virtual.ruler" = { + bg = normal.black; + }; + "ui.virtual.inlay-hint" = { + fg = normal.magenta; + }; "diagnostic.warning" = { underline = { color = bright.yellow; @@ -143,12 +170,18 @@ in { }; }; "markup.heading" = bright.cyan; - "markup.bold" = {modifiers = ["bold"];}; - "markup.italic" = {modifiers = ["italic"];}; - "markup.strikethrough" = {modifiers = ["crossed_out"];}; + "markup.bold" = { + modifiers = [ "bold" ]; + }; + "markup.italic" = { + modifiers = [ "italic" ]; + }; + "markup.strikethrough" = { + modifiers = [ "crossed_out" ]; + }; "markup.link.url" = { fg = bright.green; - modifiers = ["underlined"]; + modifiers = [ "underlined" ]; }; "markup.link.text" = bright.red; "markup.raw" = bright.red; @@ -168,7 +201,13 @@ in { normal = "block"; select = "underline"; }; - statusline.left = ["mode" "spinner" "version-control" "file-name" "file-modification-indicator"]; + statusline.left = [ + "mode" + "spinner" + "version-control" + "file-name" + "file-modification-indicator" + ]; lsp.display-messages = true; # keys = let # extend = { @@ -186,15 +225,15 @@ in { language = [ { name = "rust"; - language-servers = ["rust-analyzer"]; + language-servers = [ "rust-analyzer" ]; } { name = "nix"; - language-servers = ["nil"]; - file-types = ["nix"]; - # auto-format = true; + language-servers = [ "nil" ]; + file-types = [ "nix" ]; + auto-format = true; formatter = { - command = "alejandra"; + command = "nixfmt"; }; } ]; @@ -219,7 +258,7 @@ in { }; }; }; - }; #language-server - }; #languages - }; #helix config + }; # language-server + }; # languages + }; # helix config } diff --git a/home/programs/kitty.nix b/home/programs/kitty.nix index 4cf83c6..67f8494 100644 --- a/home/programs/kitty.nix +++ b/home/programs/kitty.nix @@ -1,22 +1,22 @@ { - config, lib, pkgs, ... -}: let +}: +let palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; - palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette; -in { +in +{ programs.kitty = with pkgs.rice; { enable = true; font = with fonts; { - name = monospace.name; - size = monospace.size; + inherit (monospace) name; + inherit (monospace) size; }; settings = with palette-hex; { foreground = util.fg; background = util.bg; - cursor = util.cursor; + inherit (util) cursor; cursor_text = util.bg; selection_foreground = util.fg_sel; selection_background = util.bg_sel; diff --git a/home/programs/murex.nix b/home/programs/murex.nix index 1d7346a..cadaf37 100644 --- a/home/programs/murex.nix +++ b/home/programs/murex.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ programs.murex = { enable = true; direnv = true; @@ -60,25 +61,28 @@ fresh ''; - plugins = let - inherit - (pkgs) + plugins = + let + inherit (pkgs) + murex-jump + murex-starship + ; + in + [ murex-jump murex-starship - ; - in [ - murex-jump - murex-starship - ]; + ]; }; programs.starship = { enable = true; }; - home.packages = let - inherit (pkgs) jump; - in [ - jump - ]; + home.packages = + let + inherit (pkgs) jump; + in + [ + jump + ]; } diff --git a/home/programs/ollama.nix b/home/programs/ollama.nix index 8525eda..7ff9e0e 100644 --- a/home/programs/ollama.nix +++ b/home/programs/ollama.nix @@ -3,71 +3,76 @@ lib, config, ... -}: { +}: +{ xdg.desktopEntries.ollama = { name = "Ollama"; type = "Application"; icon = ../icons/ollama.png; - exec = let - inherit (lib) getExe getExe'; - notify-send = "${getExe' pkgs.libnotify "notify-send"} -a \"Ollama\""; - systemctl = "${getExe' pkgs.systemd "systemctl"}"; - podman = "${getExe pkgs.podman}"; - in "${pkgs.writeShellScript "ollama" '' - set -euo pipefail + exec = + let + inherit (lib) getExe getExe'; + notify-send = "${getExe' pkgs.libnotify "notify-send"} -a \"Ollama\""; + systemctl = "${getExe' pkgs.systemd "systemctl"}"; + podman = "${getExe pkgs.podman}"; + in + "${pkgs.writeShellScript "ollama" '' + set -euo pipefail - exit_error() { - ${notify-send} -w "Failure" $1 - exit 1 - } + exit_error() { + ${notify-send} -w "Failure" $1 + exit 1 + } - container_checks() { - if [ "$(${podman} inspect -f {{.State.Health.Status}} ollama)" == "healthy" ]; then - return 0 - else - return 1 - fi - } + container_checks() { + if [ "$(${podman} inspect -f {{.State.Health.Status}} ollama)" == "healthy" ]; then + return 0 + else + return 1 + fi + } - ${notify-send} "Launching Ollama.." "Please be patient." + ${notify-send} "Launching Ollama.." "Please be patient." - ${systemctl} --user start podman-ollama - checks=0 - until container_checks; do - sleep 2 - checks=$((checks+1)) - if [ $((checks%10)) -eq 0 ]; then - ${notify-send} "Launching.." - fi - if [ $checks -ge 60 ]; then - ${systemctl} --no-block --user stop podman-ollama.target - exit_error "Failed to launch!" - fi - done + ${systemctl} --user start podman-ollama + checks=0 + until container_checks; do + sleep 2 + checks=$((checks+1)) + if [ $((checks%10)) -eq 0 ]; then + ${notify-send} "Launching.." + fi + if [ $checks -ge 60 ]; then + ${systemctl} --no-block --user stop podman-ollama.target + exit_error "Failed to launch!" + fi + done - ${notify-send} "Ollama serving on port 11434." - ''}"; + ${notify-send} "Ollama serving on port 11434." + ''}"; }; services.podman = { - containers.ollama = let - username = config.mainUser; - in { - image = "docker.io/ollama/ollama:latest"; - devices = ["nvidia.com/gpu=all"]; - autoStart = false; - autoUpdate = "registry"; - network = ["ollama"]; - ports = ["11434:11434"]; - volumes = [ - "/home/${username}/.local/share/ollama:/models" - ]; - environment.OLLAMA_MODELS = "/models"; - extraPodmanArgs = [ - "--health-cmd" - (lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/11434'") - ]; - }; + containers.ollama = + let + username = config.mainUser; + in + { + image = "docker.io/ollama/ollama:latest"; + devices = [ "nvidia.com/gpu=all" ]; + autoStart = false; + autoUpdate = "registry"; + network = [ "ollama" ]; + ports = [ "11434:11434" ]; + volumes = [ + "/home/${username}/.local/share/ollama:/models" + ]; + environment.OLLAMA_MODELS = "/models"; + extraPodmanArgs = [ + "--health-cmd" + (lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/11434'") + ]; + }; networks.ollama = { subnet = "192.168.10.0/24"; diff --git a/home/programs/openwebui.nix b/home/programs/openwebui.nix index 93166ad..75ec292 100644 --- a/home/programs/openwebui.nix +++ b/home/programs/openwebui.nix @@ -1,11 +1,12 @@ { lib, - pkgs, ... -}: let +}: +let port = 3021; -in { - imports = [./ollama.nix]; +in +{ + imports = [ ./ollama.nix ]; localWebApps = { openwebui = { @@ -13,28 +14,35 @@ in { genericName = "LLM"; icon = ../icons/openwebui.png; inherit port; - requires.containers = ["openwebui" "ollama"]; + requires.containers = [ + "openwebui" + "ollama" + ]; }; }; services.podman = { - containers.openwebui = let - str = builtins.toString; - in { - # serviceName = "openwebui"; - image = "ghcr.io/open-webui/open-webui:main"; - ports = ["${str port}:${str port}"]; - environment = { - WEBUI_AUTH = "False"; - PORT = "${str port}"; + containers.openwebui = + let + str = builtins.toString; + in + { + # serviceName = "openwebui"; + image = "ghcr.io/open-webui/open-webui:main"; + ports = [ "${str port}:${str port}" ]; + environment = { + WEBUI_AUTH = "False"; + PORT = "${str port}"; + }; + autoStart = false; + networks = [ "ollama" ]; + unitConfig = { + Requires = [ "podman-ollama.service" ]; + }; + extraOptions = [ + "--health-cmd" + (lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/${str port}'") + ]; }; - autoStart = false; - networks = ["ollama"]; - unitConfig = {Requires = ["podman-ollama.service"];}; - extraOptions = [ - "--health-cmd" - (lib.escapeShellArg "bash -c 'cat < /dev/null > /dev/tcp/localhost/${str port}'") - ]; - }; }; } diff --git a/home/programs/stable-diffusion.nix b/home/programs/stable-diffusion.nix index 051a37f..8f17ddb 100644 --- a/home/programs/stable-diffusion.nix +++ b/home/programs/stable-diffusion.nix @@ -1,12 +1,9 @@ { lib, - pkgs, config, ... -}: let - inherit (lib) getExe; - inherit (config.home) homeDirectory; -in { +}: +{ localWebApps = { stable-diffusion = { name = "Stable Diffusion"; @@ -14,7 +11,7 @@ in { icon = ../icons/comfyui.png; id = 5; port = 7860; - requires = ["stable-diffusion"]; + requires = [ "stable-diffusion" ]; }; }; } diff --git a/home/programs/vscode.nix b/home/programs/vscode.nix index 9006f5c..202a89b 100644 --- a/home/programs/vscode.nix +++ b/home/programs/vscode.nix @@ -1,17 +1,19 @@ -{pkgs, ...}: { +{ pkgs, inputs, ... }: +{ programs.vscode = { enable = true; - extensions = with pkgs.vscode-extensions; [ + extensions = with inputs.nix-vscode.extensions.x86_64-linux.vscode-marketplace; [ rust-lang.rust-analyzer - serayuzgur.crates + ocamllabs.ocaml-platform jnoortheen.nix-ide - # arrterian.nix-env-selector mkhl.direnv - continue.continue - # silverquark.dancehelix - # gregoire.dance + barbosshack.crates-io + vadimcn.vscode-lldb + kamadorueda.alejandra + kend.dancehelixkey + hikionori.kanagawa-vscode-theme ]; - mutableExtensionsDir = true; + mutableExtensionsDir = false; userSettings = { "window.titleBarStyle" = "custom"; "editor.fontFamily" = "${pkgs.rice.fonts.monospace.name}"; diff --git a/home/programs/wlogout.nix b/home/programs/wlogout.nix index e13ebb6..e3f396c 100644 --- a/home/programs/wlogout.nix +++ b/home/programs/wlogout.nix @@ -1,39 +1,43 @@ { - config, lib, pkgs, ... -}: let +}: +let palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; -in { +in +{ programs.wlogout = { enable = true; package = pkgs.wleave; layout = builtins.fromJSON (builtins.readFile ../dots/wlogout/layout); - style = with palette-hex; (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)); + style = + with palette-hex; + (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; @@ -63,5 +67,5 @@ in { # (builtins.readFile ../dots/wlogout/style.css)); # }; - home.packages = [pkgs.wlogout]; + home.packages = [ pkgs.wlogout ]; } diff --git a/home/programs/xresources.nix b/home/programs/xresources.nix index faa10cd..89dbc97 100644 --- a/home/programs/xresources.nix +++ b/home/programs/xresources.nix @@ -3,11 +3,13 @@ lib, config, ... -}: let +}: +let inherit (lib) getExe; inherit (config.home) homeDirectory; palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; -in { +in +{ ezOneShots = with pkgs; { xrdb = "${getExe xorg.xrdb} -load ${homeDirectory}/.Xresources"; }; diff --git a/home/programs/zsh.nix b/home/programs/zsh.nix index e33c93c..77a61dd 100644 --- a/home/programs/zsh.nix +++ b/home/programs/zsh.nix @@ -1,12 +1,9 @@ { - config, lib, pkgs, ... -}: let - palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; - palette-shex = pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette; -in { +}: +{ programs.zsh = { enable = true; autosuggestion.enable = true; diff --git a/home/util/containers.nix b/home/util/containers.nix index 21ce9f3..7231899 100644 --- a/home/util/containers.nix +++ b/home/util/containers.nix @@ -3,363 +3,382 @@ lib, pkgs, ... -}: let - containerOptions = {...}: { - options = { - pullPolicy = mkOption { - type = with types; str; - description = "Podman container pulling policy"; - default = "newer"; - }; - image = mkOption { - type = with types; str; - description = "OCI image to run."; - example = "library/hello-world"; - }; - - imageFile = mkOption { - type = with types; nullOr package; - default = null; - description = '' - Path to an image file to load before running the image. This can - be used to bypass pulling the image from the registry. - - The `image` attribute must match the name and - tag of the image contained in this file, as they will be used to - run the container with that image. If they do not match, the - image will be pulled from the registry as usual. - ''; - example = literalExpression "pkgs.dockerTools.buildImage {...};"; - }; - - login = { - username = mkOption { - type = with types; nullOr str; - default = null; - description = "Username for login."; +}: +let + containerOptions = + _: + { + options = { + pullPolicy = mkOption { + type = with types; str; + description = "Podman container pulling policy"; + default = "newer"; + }; + image = mkOption { + type = with types; str; + description = "OCI image to run."; + example = "library/hello-world"; }; - passwordFile = mkOption { - type = with types; nullOr str; + imageFile = mkOption { + type = with types; nullOr package; default = null; - description = "Path to file containing password."; - example = "/etc/nixos/dockerhub-password.txt"; + description = '' + Path to an image file to load before running the image. This can + be used to bypass pulling the image from the registry. + + The `image` attribute must match the name and + tag of the image contained in this file, as they will be used to + run the container with that image. If they do not match, the + image will be pulled from the registry as usual. + ''; + example = literalExpression "pkgs.dockerTools.buildImage {...};"; }; - registry = mkOption { - type = with types; nullOr str; - default = null; - description = "Registry where to login to."; - example = "https://docker.pkg.github.com"; + login = { + username = mkOption { + type = with types; nullOr str; + default = null; + description = "Username for login."; + }; + + passwordFile = mkOption { + type = with types; nullOr str; + default = null; + description = "Path to file containing password."; + example = "/etc/nixos/dockerhub-password.txt"; + }; + + registry = mkOption { + type = with types; nullOr str; + default = null; + description = "Registry where to login to."; + example = "https://docker.pkg.github.com"; + }; }; - }; - cmd = mkOption { - type = with types; listOf str; - default = []; - description = "Commandline arguments to pass to the image's entrypoint."; - example = literalExpression '' - ["--port=9000"] - ''; - }; + cmd = mkOption { + type = with types; listOf str; + default = [ ]; + description = "Commandline arguments to pass to the image's entrypoint."; + example = literalExpression '' + ["--port=9000"] + ''; + }; - labels = mkOption { - type = with types; attrsOf str; - default = {}; - description = "Labels to attach to the container at runtime."; - example = literalExpression '' - { - "traefik.https.routers.example.rule" = "Host(`example.container`)"; - } - ''; - }; - - entrypoint = mkOption { - type = with types; nullOr str; - description = "Override the default entrypoint of the image."; - default = null; - example = "/bin/my-app"; - }; - - environment = mkOption { - type = with types; attrsOf str; - default = {}; - description = "Environment variables to set for this container."; - example = literalExpression '' - { - DATABASE_HOST = "db.example.com"; - DATABASE_PORT = "3306"; - } - ''; - }; - - environmentFiles = mkOption { - type = with types; listOf path; - default = []; - description = "Environment files for this container."; - example = literalExpression '' - [ - /path/to/.env - /path/to/.env.secret - ] - ''; - }; - - log-driver = mkOption { - type = types.str; - default = "journald"; - description = '' - Logging driver for the container. The default of - `"journald"` means that the container's logs will be - handled as part of the systemd unit. - - For more details and a full list of logging drivers, refer to podman documentation. - - For Docker: - [Docker engine documentation](https://docs.docker.com/engine/reference/run/#logging-drivers---log-driver) - - For Podman: - Refer to the docker-run(1) man page. - ''; - }; - - ports = mkOption { - type = with types; listOf str; - default = []; - description = '' - Network ports to publish from the container to the outer host. - - Valid formats: - - `::` - - `::` - - `:` - - `` - - Both `hostPort` and `containerPort` can be specified as a range of - ports. When specifying ranges for both, the number of container - ports in the range must match the number of host ports in the - range. Example: `1234-1236:1234-1236/tcp` - - When specifying a range for `hostPort` only, the `containerPort` - must *not* be a range. In this case, the container port is published - somewhere within the specified `hostPort` range. - Example: `1234-1236:1234/tcp` - - Refer to the - [Docker engine documentation](https://docs.docker.com/engine/reference/run/#expose-incoming-ports) for full details. - ''; - example = literalExpression '' - [ - "8080:9000" - ] - ''; - }; - - user = mkOption { - type = with types; nullOr str; - default = null; - description = '' - Override the username or UID (and optionally groupname or GID) used - in the container. - ''; - example = "nobody:nogroup"; - }; - - volumes = mkOption { - type = with types; listOf str; - default = []; - description = '' - List of volumes to attach to this container. - - Note that this is a list of `"src:dst"` strings to - allow for `src` to refer to `/nix/store` paths, which - would be difficult with an attribute set. There are - also a variety of mount options available as a third - field; please refer to the - [docker engine documentation](https://docs.docker.com/engine/reference/run/#volume-shared-filesystems) for details. - ''; - example = literalExpression '' - [ - "volume_name:/path/inside/container" - "/path/on/host:/path/inside/container" - ] - ''; - }; - - workdir = mkOption { - type = with types; nullOr str; - default = null; - description = "Override the default working directory for the container."; - example = "/var/lib/hello_world"; - }; - - dependsOn = mkOption { - type = with types; listOf str; - default = []; - description = '' - Define which other containers this one depends on. They will be added to both After and Requires for the unit. - - Use the same name as the attribute under `virtualisation.oci-containers.containers`. - ''; - example = literalExpression '' - containers = { - node1 = {}; - node2 = { - dependsOn = [ "node1" ]; + labels = mkOption { + type = with types; attrsOf str; + default = { }; + description = "Labels to attach to the container at runtime."; + example = literalExpression '' + { + "traefik.https.routers.example.rule" = "Host(`example.container`)"; } - } + ''; + }; + + entrypoint = mkOption { + type = with types; nullOr str; + description = "Override the default entrypoint of the image."; + default = null; + example = "/bin/my-app"; + }; + + environment = mkOption { + type = with types; attrsOf str; + default = { }; + description = "Environment variables to set for this container."; + example = literalExpression '' + { + DATABASE_HOST = "db.example.com"; + DATABASE_PORT = "3306"; + } + ''; + }; + + environmentFiles = mkOption { + type = with types; listOf path; + default = [ ]; + description = "Environment files for this container."; + example = literalExpression '' + [ + /path/to/.env + /path/to/.env.secret + ] + ''; + }; + + log-driver = mkOption { + type = types.str; + default = "journald"; + description = '' + Logging driver for the container. The default of + `"journald"` means that the container's logs will be + handled as part of the systemd unit. + + For more details and a full list of logging drivers, refer to podman documentation. + + For Docker: + [Docker engine documentation](https://docs.docker.com/engine/reference/run/#logging-drivers---log-driver) + + For Podman: + Refer to the docker-run(1) man page. + ''; + }; + + ports = mkOption { + type = with types; listOf str; + default = [ ]; + description = '' + Network ports to publish from the container to the outer host. + + Valid formats: + - `::` + - `::` + - `:` + - `` + + Both `hostPort` and `containerPort` can be specified as a range of + ports. When specifying ranges for both, the number of container + ports in the range must match the number of host ports in the + range. Example: `1234-1236:1234-1236/tcp` + + When specifying a range for `hostPort` only, the `containerPort` + must *not* be a range. In this case, the container port is published + somewhere within the specified `hostPort` range. + Example: `1234-1236:1234/tcp` + + Refer to the + [Docker engine documentation](https://docs.docker.com/engine/reference/run/#expose-incoming-ports) for full details. + ''; + example = literalExpression '' + [ + "8080:9000" + ] + ''; + }; + + user = mkOption { + type = with types; nullOr str; + default = null; + description = '' + Override the username or UID (and optionally groupname or GID) used + in the container. + ''; + example = "nobody:nogroup"; + }; + + volumes = mkOption { + type = with types; listOf str; + default = [ ]; + description = '' + List of volumes to attach to this container. + + Note that this is a list of `"src:dst"` strings to + allow for `src` to refer to `/nix/store` paths, which + would be difficult with an attribute set. There are + also a variety of mount options available as a third + field; please refer to the + [docker engine documentation](https://docs.docker.com/engine/reference/run/#volume-shared-filesystems) for details. + ''; + example = literalExpression '' + [ + "volume_name:/path/inside/container" + "/path/on/host:/path/inside/container" + ] + ''; + }; + + workdir = mkOption { + type = with types; nullOr str; + default = null; + description = "Override the default working directory for the container."; + example = "/var/lib/hello_world"; + }; + + dependsOn = mkOption { + type = with types; listOf str; + default = [ ]; + description = '' + Define which other containers this one depends on. They will be added to both After and Requires for the unit. + + Use the same name as the attribute under `virtualisation.oci-containers.containers`. + ''; + example = literalExpression '' + containers = { + node1 = {}; + node2 = { + dependsOn = [ "node1" ]; + } + } + ''; + }; + + hostname = mkOption { + type = with types; nullOr str; + default = null; + description = "The hostname of the container."; + example = "hello-world"; + }; + + preRunExtraOptions = mkOption { + type = with types; listOf str; + default = [ ]; + description = "Extra options for podman that go before the `run` argument."; + example = [ + "--runtime" + "runsc" + ]; + }; + + extraOptions = mkOption { + type = with types; listOf str; + default = [ ]; + description = "Extra options for podman run`."; + example = literalExpression '' + ["--network=host"] + ''; + }; + + autoStart = mkOption { + type = types.bool; + default = false; + description = '' + When enabled, the container is automatically started on boot. + If this option is set to false, the container has to be started on-demand via its service. + ''; + }; + }; + }; + + mkService = + name: container: + let + podman = lib.getExe pkgs.podman; + rm = lib.getExe' pkgs.coreutils "rm"; + printf = lib.getExe' pkgs.coreutils "printf"; + getId = ''"$(${lib.getExe' pkgs.coreutils "id"} -u)"''; + dependsOn = map (x: "podman-${x}.service") container.dependsOn; + escapedName = lib.escapeShellArg name; + preStartScript = pkgs.writeShellApplication { + name = "pre-start"; + runtimeInputs = [ ]; + text = '' + ${printf} "Running pre-start script.." + ${podman} rm -f ${name} || true + ${lib.optionalString (container.imageFile != null) '' + ${podman} load -i ${container.imageFile} + ''} + ${rm} -f /run/user/${getId}/podman-${escapedName}.ctr-id + ${printf} " success.\nStarting Podman...\n" ''; }; + script = concatStringsSep " \\\n " ( + [ + "exec ${podman} " + ] + ++ map escapeShellArg container.preRunExtraOptions + ++ [ + "run" + "--log-level=debug" + "--rm" + "--name=${escapedName}" + "--log-driver=${container.log-driver}" + ] + ++ optional (container.entrypoint != null) "--entrypoint=${escapeShellArg container.entrypoint}" + ++ optional (container.hostname != null) "--hostname=${escapeShellArg container.hostname}" + ++ optional (container.pullPolicy != null) "--pull=${container.pullPolicy}" + ++ [ + "--cidfile=/run/user/${getId}/podman-${escapedName}.ctr-id" + # "--sdnotify=ignore" + "--cgroups=no-conmon" + "--sdnotify=conmon" + "-d" + "--replace" + ] + ++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") container.environment) + ++ map (f: "--env-file ${escapeShellArg f}") container.environmentFiles + ++ map (p: "-p ${escapeShellArg p}") container.ports + ++ optional (container.user != null) "-u ${escapeShellArg container.user}" + ++ map (v: "-v ${escapeShellArg v}") container.volumes + ++ (mapAttrsToList (k: v: "-l ${escapeShellArg k}=${escapeShellArg v}") container.labels) + ++ optional (container.workdir != null) "-w ${escapeShellArg container.workdir}" + ++ map escapeShellArg container.extraOptions + ++ [ container.image ] + ++ map escapeShellArg container.cmd + ); - hostname = mkOption { - type = with types; nullOr str; - default = null; - description = "The hostname of the container."; - example = "hello-world"; + inherit (lib) + concatStringsSep + escapeShellArg + optional + mapAttrsToList + ; + in + { + Unit = { + WantedBy = lib.optional container.autoStart "default.target"; # graphical-session instead maybe? + After = dependsOn; + Requires = dependsOn; + # StopWhenUnneeded = true; }; + # TODO make network target.. + # wants = lib.optional (container.imageFile == null) "network-online.target"; + # after = lib.optionals (container.imageFile == null) [ "network-online.target" ] + # ++ dependsOn; + # environment = proxy_env; - preRunExtraOptions = mkOption { - type = with types; listOf str; - default = []; - description = "Extra options for podman that go before the `run` argument."; - example = ["--runtime" "runsc"]; - }; - - extraOptions = mkOption { - type = with types; listOf str; - default = []; - description = "Extra options for podman run`."; - example = literalExpression '' - ["--network=host"] - ''; - }; - - autoStart = mkOption { - type = types.bool; - default = false; - description = '' - When enabled, the container is automatically started on boot. - If this option is set to false, the container has to be started on-demand via its service. - ''; + Service = { + ### There is no generalized way of supporting `reload` for docker + ### containers. Some containers may respond well to SIGHUP sent to their + ### init process, but it is not guaranteed; some apps have other reload + ### mechanisms, some don't have a reload signal at all, and some docker + ### images just have broken signal handling. The best compromise in this + ### case is probably to leave ExecReload undefined, so `systemctl reload` + ### will at least result in an error instead of potentially undefined + ### behaviour. + ### + ### Advanced users can still override this part of the unit to implement + ### a custom reload handler, since the result of all this is a normal + ### systemd service from the perspective of the NixOS module system. + ### + # ExecReload = ...; + ### + ExecStartPre = [ "${preStartScript}/bin/pre-start" ]; + ExecStart = [ + "${pkgs.writeShellScript "start" script}" + ]; + ExecStop = [ + "${podman} stop --ignore --cidfile=/run/user/${getId}/podman-${escapedName}.ctr-id" + "${podman} rm -f --ignore --cidfile=/run/user/${getId}/podman-${escapedName}.ctr-id" + ]; + # TimeoutStartSec = 0; + # TimeoutStopSec = 120; + # Restart = "always"; + Environment = [ "PODMAN_SYSTEMD_UNIT=podman-${name}.service" ]; + Type = "notify"; + NotifyAccess = "all"; + # Type = "exec"; }; }; - }; - - mkService = name: container: let - podman = lib.getExe pkgs.podman; - rm = lib.getExe' pkgs.coreutils "rm"; - printf = lib.getExe' pkgs.coreutils "printf"; - getId = ''"$(${lib.getExe' pkgs.coreutils "id"} -u)"''; - dependsOn = map (x: "podman-${x}.service") container.dependsOn; - escapedName = lib.escapeShellArg name; - preStartScript = pkgs.writeShellApplication { - name = "pre-start"; - runtimeInputs = []; - text = '' - ${printf} "Running pre-start script.." - ${podman} rm -f ${name} || true - ${lib.optionalString (container.imageFile != null) '' - ${podman} load -i ${container.imageFile} - ''} - ${rm} -f /run/user/${getId}/podman-${escapedName}.ctr-id - ${printf} " success.\nStarting Podman...\n" - ''; - }; - script = concatStringsSep " \\\n " ( - [ - "exec ${podman} " - ] - ++ map escapeShellArg container.preRunExtraOptions - ++ [ - "run" - "--log-level=debug" - "--rm" - "--name=${escapedName}" - "--log-driver=${container.log-driver}" - ] - ++ optional (container.entrypoint != null) - "--entrypoint=${escapeShellArg container.entrypoint}" - ++ optional (container.hostname != null) - "--hostname=${escapeShellArg container.hostname}" - ++ optional (container.pullPolicy != null) - "--pull=${container.pullPolicy}" - ++ [ - "--cidfile=/run/user/${getId}/podman-${escapedName}.ctr-id" - # "--sdnotify=ignore" - "--cgroups=no-conmon" - "--sdnotify=conmon" - "-d" - "--replace" - ] - ++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") container.environment) - ++ map (f: "--env-file ${escapeShellArg f}") container.environmentFiles - ++ map (p: "-p ${escapeShellArg p}") container.ports - ++ optional (container.user != null) "-u ${escapeShellArg container.user}" - ++ map (v: "-v ${escapeShellArg v}") container.volumes - ++ (mapAttrsToList (k: v: "-l ${escapeShellArg k}=${escapeShellArg v}") container.labels) - ++ optional (container.workdir != null) "-w ${escapeShellArg container.workdir}" - ++ map escapeShellArg container.extraOptions - ++ [container.image] - ++ map escapeShellArg container.cmd - ); - - inherit (lib) concatStringsSep escapeShellArg optional mapAttrsToList; - in { - Unit = { - WantedBy = [] ++ lib.optional (container.autoStart) "default.target"; # graphical-session instead maybe? - After = dependsOn; - Requires = dependsOn; - # StopWhenUnneeded = true; - }; - # TODO make network target.. - # wants = lib.optional (container.imageFile == null) "network-online.target"; - # after = lib.optionals (container.imageFile == null) [ "network-online.target" ] - # ++ dependsOn; - # environment = proxy_env; - - Service = { - ### There is no generalized way of supporting `reload` for docker - ### containers. Some containers may respond well to SIGHUP sent to their - ### init process, but it is not guaranteed; some apps have other reload - ### mechanisms, some don't have a reload signal at all, and some docker - ### images just have broken signal handling. The best compromise in this - ### case is probably to leave ExecReload undefined, so `systemctl reload` - ### will at least result in an error instead of potentially undefined - ### behaviour. - ### - ### Advanced users can still override this part of the unit to implement - ### a custom reload handler, since the result of all this is a normal - ### systemd service from the perspective of the NixOS module system. - ### - # ExecReload = ...; - ### - ExecStartPre = ["${preStartScript}/bin/pre-start"]; - ExecStart = [ - "${pkgs.writeShellScript "start" script}" - ]; - ExecStop = [ - "${podman} stop --ignore --cidfile=/run/user/${getId}/podman-${escapedName}.ctr-id" - "${podman} rm -f --ignore --cidfile=/run/user/${getId}/podman-${escapedName}.ctr-id" - ]; - # TimeoutStartSec = 0; - # TimeoutStopSec = 120; - # Restart = "always"; - Environment = ["PODMAN_SYSTEMD_UNIT=podman-${name}.service"]; - Type = "notify"; - NotifyAccess = "all"; - # Type = "exec"; - }; - }; cfg = config.containers; - inherit (lib) mapAttrs' nameValuePair mkOption types mkIf literalExpression; -in { + inherit (lib) + mapAttrs' + nameValuePair + mkOption + types + mkIf + literalExpression + ; +in +{ options.containers = mkOption { - default = {}; + default = { }; type = with types; attrsOf (submodule containerOptions); }; - config = mkIf (cfg != {}) { + config = mkIf (cfg != { }) { systemd.user.services = mapAttrs' (k: v: nameValuePair "podman-${k}" (mkService k v)) cfg; }; } diff --git a/home/util/cosmic.nix b/home/util/cosmic.nix index 81e9b60..d4ac0c0 100644 --- a/home/util/cosmic.nix +++ b/home/util/cosmic.nix @@ -2,8 +2,20 @@ lib, config, ... -}: let - inherit (lib) filterAttrs concatStrings concatStringsSep mapAttrsToList concatLists foldlAttrs concatMapAttrs mapAttrs mapAttrs' nameValuePair boolToString; +}: +let + inherit (lib) + filterAttrs + concatStrings + concatStringsSep + mapAttrsToList + concatLists + foldlAttrs + concatMapAttrs + mapAttrs' + nameValuePair + boolToString + ; inherit (builtins) typeOf toString stringLength; # build up serialisation machinery from here for various types @@ -12,24 +24,33 @@ array = a: "[${concatStringsSep "," a}]"; # attrset -> hashmap _assoc = a: mapAttrsToList (name: val: "${name}: ${val}") a; - assoc = a: '' { + assoc = a: '' + { ${concatStringsSep ",\n" (concatLists (map _assoc a))} }''; # attrset -> struct - _struct_kv = k: v: - if v == null - then "" - else (concatStringsSep ":" [k (serialise.${typeOf v} v)]); - _struct_concat = s: + _struct_kv = + k: v: + if v == null then + "" + else + (concatStringsSep ":" [ + k + (serialise.${typeOf v} v) + ]); + _struct_concat = + s: foldlAttrs ( acc: k: v: - if stringLength acc > 0 - then concatStringsSep ", " [acc (_struct_kv k v)] - else _struct_kv k v - ) "" - s; - _struct_filt = s: - _struct_concat (filterAttrs (k: v: v != null) s); + if stringLength acc > 0 then + concatStringsSep ", " [ + acc + (_struct_kv k v) + ] + else + _struct_kv k v + ) "" s; + _struct_filt = s: _struct_concat (filterAttrs (_k: v: v != null) s); struct = s: "(${_struct_filt s})"; toQuotedString = s: ''"${toString s}"''; @@ -46,59 +67,68 @@ }; # define the key for a keybind - defineBinding = binding: + defineBinding = + binding: struct { inherit (binding) modifiers; - key = - if isNull binding.key - then null - else toQuotedString binding.key; + key = if (binding.key == null) then null else toQuotedString binding.key; }; # map keybinding from list of attrset to hashmap of (mod,key): action - _mapBindings = bindings: - map ( - inner: {"${defineBinding inner}" = maybeToString (checkAction inner.action);} - ) - bindings; - mapBindings = bindings: - assoc (_mapBindings bindings); + _mapBindings = + bindings: + map (inner: { "${defineBinding inner}" = maybeToString (checkAction inner.action); }) bindings; + mapBindings = bindings: assoc (_mapBindings bindings); # check a keybinding's action # escape with quotes if it's a Spawn action - checkAction = a: - if typeOf a == "set" && a.type == "Spawn" - then { - inherit (a) type; - data = toQuotedString a.data; - } - else a; + checkAction = + a: + if typeOf a == "set" && a.type == "Spawn" then + { + inherit (a) type; + data = toQuotedString a.data; + } + else + a; - maybeToString = s: - if typeOf s == "set" - then concatStrings [s.type "(" (toString s.data) ")"] - else s; + maybeToString = + s: + if typeOf s == "set" then + concatStrings [ + s.type + "(" + (toString s.data) + ")" + ] + else + s; - mapCosmicSettings = application: options: - mapAttrs' (k: v: + mapCosmicSettings = + application: options: + mapAttrs' ( + k: v: nameValuePair "cosmic/${application}/v${options.version}/${k}" { enable = true; text = serialise.${typeOf v} v; - }) - options.option; - # deconstructKeybindAttr = attr: mapAttrs' ( - # name: value: - # ) attr; - # rec_attr = lib.types.attrsOf (lib.types.oneOf lib.types.string rec_attr); -in { + } + ) options.option; +in +# deconstructKeybindAttr = attr: mapAttrs' ( +# name: value: +# ) attr; +# rec_attr = lib.types.attrsOf (lib.types.oneOf lib.types.string rec_attr); +{ options.cosmic = { - enable = with lib; + enable = + with lib; mkOption { default = false; type = types.bool; }; - defaultKeybindings = with lib; + defaultKeybindings = + with lib; mkOption { default = true; type = types.bool; @@ -110,15 +140,17 @@ in { # type = with types; rec_attr; # }; - keybindings = with lib; + keybindings = + with lib; mkOption { - default = []; - type = with types; + default = [ ]; + type = + with types; listOf (submodule { options = { modifiers = mkOption { type = listOf str; - default = []; + default = [ ]; }; key = mkOption { type = nullOr str; @@ -131,7 +163,10 @@ in { type = str; }; data = mkOption { - type = oneOf [str int]; + type = oneOf [ + str + int + ]; default = ""; }; }; @@ -141,10 +176,12 @@ in { }); }; - otherSettings = with lib; + otherSettings = + with lib; mkOption { - default = {}; - type = with types; + default = { }; + type = + with types; attrsOf (submodule { options = { version = mkOption { @@ -162,15 +199,14 @@ in { # TODO we need to split between system_actions, workspaces, custom config.xdg.configFile = { - "cosmic/com.system76.CosmicSettings.Shortcuts/v1/custom".text = mapBindings config.cosmic.keybindings; + "cosmic/com.system76.CosmicSettings.Shortcuts/v1/custom".text = + mapBindings config.cosmic.keybindings; "cosmic/com.system76.CosmicSettings.Shortcuts/v1/defaults" = { text = "{}"; enable = !config.cosmic.defaultKeybindings; }; } // concatMapAttrs ( - application: options: - mapCosmicSettings application options - ) - config.cosmic.otherSettings; + application: options: mapCosmicSettings application options + ) config.cosmic.otherSettings; } diff --git a/home/util/ez.nix b/home/util/ez.nix index 31378b2..678c565 100644 --- a/home/util/ez.nix +++ b/home/util/ez.nix @@ -2,30 +2,35 @@ config, lib, ... -}: { +}: +{ options = { - ezServices = with lib; + ezServices = + with lib; mkOption { type = with types; attrsOf str; - default = {}; + default = { }; }; - ezOneShots = with lib; + ezOneShots = + with lib; mkOption { type = with types; attrsOf str; - default = {}; + default = { }; }; - ezConf = with lib; + ezConf = + with lib; mkOption { type = with types; attrsOf path; - default = {}; + default = { }; }; # for specifying an additional systemd target - extraTarget = with lib; + extraTarget = + with lib; mkOption { type = with types; listOf str; - default = []; + default = [ ]; }; }; @@ -34,37 +39,33 @@ builtins.mapAttrs (name: cmd: { Unit = { Description = "${name}"; - Requires = ["graphical-session.target"] ++ config.extraTarget; - After = ["graphical-session.target"] ++ config.extraTarget; + Requires = [ "graphical-session.target" ] ++ config.extraTarget; + After = [ "graphical-session.target" ] ++ config.extraTarget; }; Service = { ExecStart = cmd; }; Install = { - WantedBy = ["graphical-session.target"] ++ config.extraTarget; + WantedBy = [ "graphical-session.target" ] ++ config.extraTarget; }; - }) - config.ezServices + }) config.ezServices // builtins.mapAttrs (name: cmd: { Unit = { Description = "${name}"; - After = ["graphical-session.target"] ++ config.extraTarget; + After = [ "graphical-session.target" ] ++ config.extraTarget; }; Service = { ExecStart = cmd; Type = "oneshot"; }; Install = { - WantedBy = ["graphical-session.target"] ++ config.extraTarget; + WantedBy = [ "graphical-session.target" ] ++ config.extraTarget; }; - }) - config.ezOneShots; + }) config.ezOneShots; - xdg.configFile = - builtins.mapAttrs (name: value: { - enable = true; - source = value; - }) - config.ezConf; + xdg.configFile = builtins.mapAttrs (_name: value: { + enable = true; + source = value; + }) config.ezConf; }; } diff --git a/home/util/firefox-webapp.nix b/home/util/firefox-webapp.nix index 1eeece3..7dbe7a5 100644 --- a/home/util/firefox-webapp.nix +++ b/home/util/firefox-webapp.nix @@ -2,22 +2,44 @@ config, lib, ... -}: let +}: +let inherit (builtins) getAttr stringLength substring; - inherit (lib) mkOption getExe listToAttrs attrsToList imap; - inherit (lib.attrsets) filterAttrs mapAttrs mapAttrs' nameValuePair; + inherit (lib) + mkOption + getExe + listToAttrs + attrsToList + imap + ; + inherit (lib.attrsets) + mapAttrs + mapAttrs' + nameValuePair + ; inherit (lib.strings) concatStringsSep toUpper; - enumerate = a: - listToAttrs (imap (id: { - name, - value, - }: { - inherit name; - value = value // {inherit id;}; - }) (attrsToList a)); - make-app-profiles = cfg: - mapAttrs' (name: cfg: + enumerate = + a: + listToAttrs ( + imap ( + id: + { + name, + value, + }: + { + inherit name; + value = value // { + inherit id; + }; + } + ) (attrsToList a) + ); + make-app-profiles = + cfg: + mapAttrs' ( + name: cfg: nameValuePair "home-manager-webapp-${name}" { inherit (cfg) id; userChrome = '' @@ -46,39 +68,39 @@ } ''; - settings = - cfg.extraSettings - // { - "browser.startup.homepage" = builtins.toString cfg.url; - "browser.sessionstore.resume_session_once" = false; - "browser.sessionstore.resume_from_crash" = false; - "browser.cache.disk.enable" = false; - "browser.cache.disk.capacity" = 0; - "browser.cache.disk.filesystem_reported" = 1; - "browser.cache.disk.smart_size.enabled" = false; - "browser.cache.disk.smart_size.first_run" = false; - "browser.cache.disk.smart_size.use_old_max" = false; - "browser.ctrlTab.previews" = true; - "browser.tabs.warnOnClose" = false; - "plugin.state.flash" = 2; - "toolkit.legacyUserProfileCustomizations.stylesheets" = true; - "browser.tabs.drawInTitlebar" = false; - "browser.tabs.inTitlebar" = 0; - "browser.contentblocking.category" = "strict"; - "network.cookie.lifetimePolicy" = 0; - "layout.css.prefers-color-scheme.content-override" = getAttr cfg.theme { - dark = 0; - light = 1; - system = 2; - }; + settings = cfg.extraSettings // { + "browser.startup.homepage" = builtins.toString cfg.url; + "browser.sessionstore.resume_session_once" = false; + "browser.sessionstore.resume_from_crash" = false; + "browser.cache.disk.enable" = false; + "browser.cache.disk.capacity" = 0; + "browser.cache.disk.filesystem_reported" = 1; + "browser.cache.disk.smart_size.enabled" = false; + "browser.cache.disk.smart_size.first_run" = false; + "browser.cache.disk.smart_size.use_old_max" = false; + "browser.ctrlTab.previews" = true; + "browser.tabs.warnOnClose" = false; + "plugin.state.flash" = 2; + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "browser.tabs.drawInTitlebar" = false; + "browser.tabs.inTitlebar" = 0; + "browser.contentblocking.category" = "strict"; + "network.cookie.lifetimePolicy" = 0; + "layout.css.prefers-color-scheme.content-override" = getAttr cfg.theme { + dark = 0; + light = 1; + system = 2; }; - }) - cfg; -in { + }; + } + ) cfg; +in +{ options.programs.firefox.webapps = mkOption { - default = {}; + default = { }; - type = with lib.types; + type = + with lib.types; attrsOf (submodule { options = { #################### @@ -102,13 +124,13 @@ in { extraArgs = mkOption { type = listOf str; - default = []; + default = [ ]; description = "Extra args to launch Firefox with."; }; extraSettings = mkOption { type = attrsOf (either bool (either int str)); - default = {}; + default = { }; description = "Additional Firefox profile settings."; }; @@ -119,7 +141,11 @@ in { }; theme = mkOption { - type = enum ["dark" "light" "system"]; + type = enum [ + "dark" + "light" + "system" + ]; default = "system"; description = "The application CSS theme to use, if supported."; }; @@ -138,7 +164,11 @@ in { mimeType = mkOption { description = "The MIME type(s) supported by this application."; type = nullOr (listOf str); - default = ["text/html" "text/xml" "application/xhtml_xml"]; + default = [ + "text/html" + "text/xml" + "application/xhtml_xml" + ]; }; # Copied verbatim from xdg.desktopEntries. @@ -183,40 +213,48 @@ in { config = { programs.firefox.profiles = make-app-profiles (enumerate config.programs.firefox.webapps); - xdg.desktopEntries = - mapAttrs (name: cfg: { - inherit (cfg) genericName comment categories icon mimeType prefersNonDefaultGPU; + xdg.desktopEntries = mapAttrs (name: cfg: { + inherit (cfg) + genericName + comment + categories + icon + mimeType + prefersNonDefaultGPU + ; - name = - if cfg.name == null - then (toUpper (substring 0 1 name)) + (substring 1 (stringLength name) name) - else cfg.name; + name = + if cfg.name == null then + (toUpper (substring 0 1 name)) + (substring 1 (stringLength name) name) + else + cfg.name; - startupNotify = true; - terminal = false; - type = "Application"; + startupNotify = true; + terminal = false; + type = "Application"; - exec = concatStringsSep " " ([ - "${getExe config.programs.firefox.package}" - "--name" - "${name}" - "--app-id" - "${name}" - "--class" - "${name}" - "-P" - "${config.programs.firefox.profiles."home-manager-webapp-${name}".path}" - "--no-remote" - ] - ++ cfg.extraArgs - ++ ["${cfg.url}"]); + exec = concatStringsSep " " ( + [ + "${getExe config.programs.firefox.package}" + "--name" + "${name}" + "--app-id" + "${name}" + "--class" + "${name}" + "-P" + "${config.programs.firefox.profiles."home-manager-webapp-${name}".path}" + "--no-remote" + ] + ++ cfg.extraArgs + ++ [ "${cfg.url}" ] + ); - settings = { - X-MultipleArgs = "false"; # Consider enabling, don't know what this does - StartupWMClass = "${name}"; - NoDisplay = lib.boolToString cfg.hidden; - }; - }) - config.programs.firefox.webapps; + settings = { + X-MultipleArgs = "false"; # Consider enabling, don't know what this does + StartupWMClass = "${name}"; + NoDisplay = lib.boolToString cfg.hidden; + }; + }) config.programs.firefox.webapps; }; } diff --git a/home/util/flatpak.nix b/home/util/flatpak.nix index 8383a06..6125666 100644 --- a/home/util/flatpak.nix +++ b/home/util/flatpak.nix @@ -2,62 +2,60 @@ config, lib, ... -}: let +}: +let inherit (lib) mkOption; inherit (builtins) typeOf listToAttrs; -in { +in +{ options.flatpaks = mkOption { - default = []; - type = with lib.types; - listOf (either str (submodule { - options = { - name = mkOption { - type = str; + default = [ ]; + type = + with lib.types; + listOf ( + either str (submodule { + options = { + name = mkOption { + type = str; + }; + overrides = mkOption { + type = attrsOf (attrsOf (either str (listOf str))); + default = { }; + }; }; - overrides = mkOption { - type = attrsOf (attrsOf (either str (listOf str))); - default = {}; - }; - }; - })); + }) + ); }; - config.services.flatpak = let - userOverrides = listToAttrs ( - map ( - fp: - if (typeOf fp == "string") - then { - name = fp; - value = {}; - } - else { - inherit (fp) name; - value = fp.overrides; - } - ) - config.flatpaks - ); - in { - enable = true; - uninstallUnmanaged = true; - update.auto.enable = true; - packages = - map ( - fp: - if (typeOf fp == "set") - then fp.name - else fp - ) - config.flatpaks; - overrides = - userOverrides - // { + config.services.flatpak = + let + userOverrides = listToAttrs ( + map ( + fp: + if (typeOf fp == "string") then + { + name = fp; + value = { }; + } + else + { + inherit (fp) name; + value = fp.overrides; + } + ) config.flatpaks + ); + in + { + enable = true; + uninstallUnmanaged = true; + update.auto.enable = true; + packages = map (fp: if (typeOf fp == "set") then fp.name else fp) config.flatpaks; + overrides = userOverrides // { global = { - Context.sockets = ["wayland"]; + Context.sockets = [ "wayland" ]; Environment = { ELECTRON_OZONE_PLATFORM_HINT = "auto"; }; }; }; - }; + }; } diff --git a/home/util/local-webapp.nix b/home/util/local-webapp.nix index 429b2ed..a42c977 100644 --- a/home/util/local-webapp.nix +++ b/home/util/local-webapp.nix @@ -3,9 +3,9 @@ pkgs, lib, ... -}: let - inherit - (lib) +}: +let + inherit (lib) mkOption mkForce getExe @@ -20,106 +20,104 @@ replaceStrings concatMapStringsSep ; - partOf = cfg: "${replaceStrings [" "] ["-"] (toLower cfg.name)}.target"; + partOf = cfg: "${replaceStrings [ " " ] [ "-" ] (toLower cfg.name)}.target"; # make a firefox webapp + hidden .desktop entry for the client app - make-firefox = cfg: + make-firefox = + cfg: mapAttrs' ( name: cfg: - nameValuePair "${name}-client" - { - inherit (cfg) name; - url = "http://127.0.0.1:${builtins.toString cfg.port}"; - extraSettings = config.programs.firefox.profiles.default.settings; - hidden = true; - } - ) - cfg; - # make a systemd service for running the frontend - make-systemd-service = cfg: - mapAttrs' ( - name: cfg: - if - (cfg.service - != null) - then - nameValuePair "${cfg.name}-frontend" { - Unit = { - Description = "${cfg.name} Frontend"; - WantedBy = mkForce []; - }; - - Service = cfg.service; - } - else nameValuePair "" {} - ) - cfg; - # modify systemd units to be PartOf this target - modify-systemd-services = cfg: - listToAttrs (flatten (mapAttrsToList ( - name: cfg: (map ( - req: { - name = "${req}"; - value = { - Unit = { - PartOf = partOf cfg; - }; - }; - } - ) - cfg.requires.services) - ) - cfg)); - modify-quadlets = cfg: - listToAttrs (flatten (mapAttrsToList ( - name: cfg: (map ( - req: { - name = "${req}"; - value = { - extraConfig.Unit.PartOf = partOf cfg; - }; - } - ) - cfg.requires.containers) - ) - cfg)); - # make a systemd target to collate dependencies - make-systemd-target = cfg: - mapAttrs ( - name: cfg: { - Unit = { - Description = "${cfg.name} Target"; - WantedBy = mkForce []; - Requires = - (map (req: req + ".service") cfg.requires.services) - ++ (map (req: "podman-" + req + ".service") cfg.requires.containers); - }; + nameValuePair "${name}-client" { + inherit (cfg) name; + url = "http://127.0.0.1:${builtins.toString cfg.port}"; + extraSettings = config.programs.firefox.profiles.default.settings; + hidden = true; } - ) - cfg; + ) cfg; + # make a systemd service for running the frontend + make-systemd-service = + cfg: + mapAttrs' ( + name: cfg: + if (cfg.service != null) then + nameValuePair "${cfg.name}-frontend" { + Unit = { + Description = "${cfg.name} Frontend"; + WantedBy = mkForce [ ]; + }; + + Service = cfg.service; + } + else + nameValuePair "" { } + ) cfg; + # modify systemd units to be PartOf this target + modify-systemd-services = + cfg: + listToAttrs ( + flatten ( + mapAttrsToList ( + name: cfg: + (map (req: { + name = "${req}"; + value = { + Unit = { + PartOf = partOf cfg; + }; + }; + }) cfg.requires.services) + ) cfg + ) + ); + modify-quadlets = + cfg: + listToAttrs ( + flatten ( + mapAttrsToList ( + name: cfg: + (map (req: { + name = "${req}"; + value = { + extraConfig.Unit.PartOf = partOf cfg; + }; + }) cfg.requires.containers) + ) cfg + ) + ); + # make a systemd target to collate dependencies + make-systemd-target = + cfg: + mapAttrs (name: cfg: { + Unit = { + Description = "${cfg.name} Target"; + WantedBy = mkForce [ ]; + Requires = + (map (req: req + ".service") cfg.requires.services) + ++ (map (req: "podman-" + req + ".service") cfg.requires.containers); + }; + }) cfg; # make desktop shortcuts and a script which will handle starting everything - make-xdg = cfg: - mapAttrs ( - name: cfg: { - inherit (cfg) name icon genericName; - type = "Application"; - exec = "${let + make-xdg = + cfg: + mapAttrs (name: cfg: { + inherit (cfg) name icon genericName; + type = "Application"; + exec = "${ + let notify-send = "${getExe' pkgs.libnotify "notify-send"} -a \"${cfg.name}\""; systemctl = "${getExe' pkgs.systemd "systemctl"}"; dex = "${getExe pkgs.dex}"; podman = "${getExe pkgs.podman}"; - makeContainerCheck = container: ''[ "$(${podman} inspect -f {{.State.Health.Status}} ${container})" == "healthy" ]''; + makeContainerCheck = + container: ''[ "$(${podman} inspect -f {{.State.Health.Status}} ${container})" == "healthy" ]''; # makeContainerCheck = container: '' # [ ${podman} inspect -f {{.State.Status}} ${container})" != "running" ] # ''; containerChecks = - if (cfg.requires.containers != []) - then + if (cfg.requires.containers != [ ]) then '' container_checks() { if '' - + (concatMapStringsSep " && " - (container: makeContainerCheck container) - cfg.requires.containers) + + (concatMapStringsSep " && " makeContainerCheck cfg.requires.containers) + '' ; then return 0 @@ -128,54 +126,55 @@ fi } '' - else '' - container_checks() { - return 0 - } - ''; + else + '' + container_checks() { + return 0 + } + ''; in - pkgs.writeShellScript "${name}" - '' - set -euo pipefail + pkgs.writeShellScript "${name}" '' + set -euo pipefail - exit_error() { - ${notify-send} -w "Failure" $1 - exit 1 - } + exit_error() { + ${notify-send} -w "Failure" $1 + exit 1 + } - ${containerChecks} + ${containerChecks} - ${notify-send} "Launching ${name} backend.." "Please be patient." - ${systemctl} --user start ${name}.target || exit_error "Failed to launch!" + ${notify-send} "Launching ${name} backend.." "Please be patient." + ${systemctl} --user start ${name}.target || exit_error "Failed to launch!" - checks=0 - until container_checks; do - sleep 2 - checks=$((checks+1)) - if [ $((checks%10)) -eq 0 ]; then - ${notify-send} "Waiting for backend." - fi - if [ $checks -ge 60 ]; then - ${systemctl} --no-block --user stop ${name}.target - exit_error "Failed to launch!" - fi - done + checks=0 + until container_checks; do + sleep 2 + checks=$((checks+1)) + if [ $((checks%10)) -eq 0 ]; then + ${notify-send} "Waiting for backend." + fi + if [ $checks -ge 60 ]; then + ${systemctl} --no-block --user stop ${name}.target + exit_error "Failed to launch!" + fi + done - ${notify-send} "Launching ${name}.." - ${dex} -w ~/.nix-profile/share/applications/${name}-client.desktop + ${notify-send} "Launching ${name}.." + ${dex} -w ~/.nix-profile/share/applications/${name}-client.desktop - ${notify-send} "Goodbye" "Shutting down." - ${systemctl} --user stop ${name}.target - exit 0 - ''}"; - } - ) - cfg; + ${notify-send} "Goodbye" "Shutting down." + ${systemctl} --user stop ${name}.target + exit 0 + '' + }"; + }) cfg; cfg = config.localWebApps; -in { +in +{ options.localWebApps = mkOption { - default = {}; - type = with lib.types; + default = { }; + type = + with lib.types; attrsOf (submodule { options = { name = mkOption { @@ -200,11 +199,11 @@ in { options = { containers = mkOption { type = listOf str; - default = []; + default = [ ]; }; services = mkOption { type = listOf str; - default = []; + default = [ ]; }; }; }); diff --git a/home/util/murex.nix b/home/util/murex.nix index 46c163b..c1d61a4 100644 --- a/home/util/murex.nix +++ b/home/util/murex.nix @@ -1,20 +1,26 @@ { lib, - pkgs, config, ... -}: let - inherit (lib) mkEnableOption mkOption mkIf types; +}: +let + inherit (lib) + mkEnableOption + mkOption + mkIf + types + ; inherit (builtins) listToAttrs; cfg = config.programs.murex; -in { +in +{ options.programs.murex = { enable = mkEnableOption "murex shell"; managePlugins = mkEnableOption "plugin management"; direnv = mkEnableOption "direnv integration"; plugins = mkOption { type = with types; listOf package; - default = []; + default = [ ]; }; profile = mkOption { type = types.str; @@ -27,16 +33,18 @@ in { useXdgConfig = mkEnableOption "override MUREX_{PRELOAD,MODULES,PROFILE} env vars to conform to XDG_CONFIG_HOME"; }; config = mkIf cfg.enable { - home.file = let - plugins = listToAttrs (map (plugin: { - name = ".murex_modules/${plugin.pname}"; - value = { - recursive = true; - source = plugin; - }; - }) - cfg.plugins); - in + home.file = + let + plugins = listToAttrs ( + map (plugin: { + name = ".murex_modules/${plugin.pname}"; + value = { + recursive = true; + source = plugin; + }; + }) cfg.plugins + ); + in lib.mergeAttrs plugins { ".murex_preload" = { text = cfg.preload; @@ -47,31 +55,31 @@ in { text = cfg.profile + ( - if cfg.direnv - then '' - direnv hook murex -> source - '' - else "" + if cfg.direnv then + '' + direnv hook murex -> source + '' + else + "" ); executable = true; enable = cfg.direnv || cfg.profile != ""; }; ".murex_modules/packages.json" = { - text = builtins.toJSON (map (plugin: { + text = builtins.toJSON ( + map (plugin: { Protocol = "nix"; URI = "nix://managed.git"; Package = plugin.pname; - }) - cfg.plugins); - enable = cfg.managePlugins && (cfg.plugins != []); + }) cfg.plugins + ); + enable = cfg.managePlugins && (cfg.plugins != [ ]); }; }; - home.sessionVariables = - mkIf - cfg.useXdgConfig { - MUREX_PRELOAD = "$XDG_CONFIG_HOME/murex/"; - MUREX_MODULES = "$XDG_CONFIG_HOME/murex/"; - MUREX_PROFILE = "$XDG_CONFIG_HOME/murex/"; - }; + home.sessionVariables = mkIf cfg.useXdgConfig { + MUREX_PRELOAD = "$XDG_CONFIG_HOME/murex/"; + MUREX_MODULES = "$XDG_CONFIG_HOME/murex/"; + MUREX_PROFILE = "$XDG_CONFIG_HOME/murex/"; + }; }; } diff --git a/home/util/name.nix b/home/util/name.nix index 4317b02..9143939 100644 --- a/home/util/name.nix +++ b/home/util/name.nix @@ -2,16 +2,20 @@ lib, config, ... -}: let +}: +let inherit (lib) mkOption; -in { +in +{ options.mainUser = mkOption { type = lib.types.str; }; - config.home = let - inherit (config) mainUser; - in { - username = mainUser; - homeDirectory = "/home/${mainUser}"; - }; + config.home = + let + inherit (config) mainUser; + in + { + username = mainUser; + homeDirectory = "/home/${mainUser}"; + }; } diff --git a/system/adrift.nix b/system/adrift.nix index 543bc68..bd20d85 100644 --- a/system/adrift.nix +++ b/system/adrift.nix @@ -1,18 +1,15 @@ { - inputs, - outputs, config, lib, pkgs, - overlays, - modulesPath, ... -}: { +}: +{ imports = [ ./configuration.nix ]; - nix.settings.trusted-users = ["plank"]; + nix.settings.trusted-users = [ "plank" ]; programs.nh.flake = "/home/plank/.nix"; boot.kernelParams = [ @@ -23,9 +20,18 @@ "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.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" = { @@ -39,7 +45,7 @@ }; swapDevices = [ - {device = "/dev/disk/by-uuid/a732641d-1233-45a7-8614-53caed60f11b";} + { device = "/dev/disk/by-uuid/a732641d-1233-45a7-8614-53caed60f11b"; } ]; boot.loader.systemd-boot.configurationLimit = 2; @@ -66,7 +72,7 @@ }; }; - services.xserver.videoDrivers = ["i915"]; + services.xserver.videoDrivers = [ "i915" ]; programs.xwayland.enable = true; xdg.portal = { @@ -85,6 +91,6 @@ networking.hostName = "adrift"; # Define your hostname. users.users.plank = { isNormalUser = true; - extraGroups = ["wheel"]; # Enable ‘sudo’ for the user. + extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. }; } diff --git a/system/cachix.nix b/system/cachix.nix index e5b5af1..871b872 100644 --- a/system/cachix.nix +++ b/system/cachix.nix @@ -1,15 +1,7 @@ -# WARN: this file will get overwritten by $ cachix use { - pkgs, - lib, ... -}: let - folder = ./cachix; - toImport = name: value: folder + ("/" + name); - filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key; - imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder)); -in { - inherit imports; +}: +{ nix.settings = { substituters = [ "https://cache.nixos.org" @@ -20,6 +12,7 @@ in { "https://walker-git.cachix.org" "https://anmonteiro.nix-cache.workers.dev" "https://viperml.cachix.org" + "https://drakon64-nixos-cachyos-kernel.cachix.org" ]; trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" @@ -30,6 +23,7 @@ in { "walker-git.cachix.org-1:vmC0ocfPWh0S/vRAQGtChuiZBTAe4wiKDeyyXM0/7pM=" "ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY=" "viperml.cachix.org-1:qZhKBMTfmcLL+OG6fj/hzsMEedgKvZVFRRAhq7j8Vh8=" + "drakon64-nixos-cachyos-kernel.cachix.org-1:J3gjZ9N6S05pyLA/P0M5y7jXpSxO/i0rshrieQJi5D0=" ]; }; } diff --git a/system/configuration.nix b/system/configuration.nix index f25b90d..b57a59e 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -1,13 +1,15 @@ { inputs, - outputs, + self, lib, pkgs, mainUser, ... -}: let +}: +let getFlakePackage = package: inputs."${package}".packages.x86_64-linux.default; -in { +in +{ # these settings propagate to home-manager's nixpkgs nixpkgs = { overlays = [ @@ -16,14 +18,12 @@ in { inputs.nil.overlays.nil # inputs.nixd.overlays.default inputs.niri.overlays.niri - # outputs.overlays.additions - outputs.overlays.rice - outputs.overlays.murex - outputs.overlays.murex-starship - outputs.overlays.murex-jump - outputs.overlays.comfyui - outputs.overlays.comfyui-plugins - # outputs.overlays.sirula + self.overlays.rice + self.overlays.murex + self.overlays.murex-starship + self.overlays.murex-jump + self.overlays.comfyui + self.overlays.comfyui-plugins ]; config = { allowUnfree = true; @@ -34,10 +34,14 @@ in { nix = { # add flake inputs to our registry to allow global use - registry = lib.mapAttrs (_: value: {flake = value;}) inputs; + registry = lib.mapAttrs (_: value: { flake = value; }) inputs; settings = { # trusted-users = ["bolt" "plank"]; - experimental-features = ["nix-command" "flakes" "pipe-operator"]; + experimental-features = [ + "nix-command" + "flakes" + "pipe-operator" + ]; substitute = true; }; extraOptions = '' @@ -106,12 +110,12 @@ in { # services.tailscale.enable = true; + # TODO - move these to more appropriate places environment.systemPackages = with pkgs; [ curl eza git jujutsu - nil ]; # services.atuin.enable = true; @@ -136,5 +140,5 @@ in { systemd.user.extraConfig = "LogLevel=debug"; - security.pam.services.swaylock = {}; + system.nixos.tags = [ "fatcock" ]; } diff --git a/system/modules/anal-retentive.nix b/system/modules/anal-retentive.nix index bac264b..cf7c868 100644 --- a/system/modules/anal-retentive.nix +++ b/system/modules/anal-retentive.nix @@ -2,7 +2,8 @@ pkgs, lib, ... -}: { +}: +{ # perlless activations boot.initrd.systemd.enable = true; # breaks everything @@ -18,7 +19,7 @@ programs.command-not-found.enable = false; boot.enableContainers = false; boot.loader.grub.enable = false; - environment.defaultPackages = lib.mkDefault []; + environment.defaultPackages = lib.mkDefault [ ]; documentation.info.enable = false; # no cppnix .. ? diff --git a/system/modules/cosmic.nix b/system/modules/cosmic.nix index 7c58a6f..d5085b3 100644 --- a/system/modules/cosmic.nix +++ b/system/modules/cosmic.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ services.desktopManager.cosmic = { enable = true; }; diff --git a/system/modules/culr.nix b/system/modules/culr.nix index 8f80fc7..c395688 100644 --- a/system/modules/culr.nix +++ b/system/modules/culr.nix @@ -1,4 +1,5 @@ -{...}: { +_: +{ programs.culr = { enable = true; pattern = "rainbow-split"; diff --git a/system/modules/docs.nix b/system/modules/docs.nix index dac49de..a37b481 100644 --- a/system/modules/docs.nix +++ b/system/modules/docs.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ environment.systemPackages = with pkgs; [ man-pages man-pages-posix diff --git a/system/modules/mullvad.nix b/system/modules/mullvad.nix index 6bd2efc..ca75289 100644 --- a/system/modules/mullvad.nix +++ b/system/modules/mullvad.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: let +}: +let # gives some output like: # Address = [ # "10.10.10.10/32" @@ -24,8 +25,14 @@ # PublicKey = [ # "xxx" # ]; - inherit (lib) mapAttrs' mapAttrs mapAttrsToList listToAttrs splitString filter filterAttrs length head last; - inherit (builtins) readFile readDir; + inherit (lib) + mapAttrsToList + listToAttrs + splitString + filterAttrs + head + ; + inherit (builtins) readDir; # parseMullvad = file: { # name = head (splitString "." file); # value = listToAttrs (map (entry: { @@ -38,24 +45,19 @@ # }; # definitions = # map parseMullvad (getFiles ../../mullvad); - getFiles = path: - mapAttrsToList (n: v: n) - (filterAttrs (n: v: v == "regular") - (readDir path)); -in { - environment.systemPackages = [pkgs.wireguard-tools.out]; - networking.wg-quick.interfaces = listToAttrs (map (f: rec { + getFiles = path: mapAttrsToList (n: _v: n) (filterAttrs (_n: v: v == "regular") (readDir path)); +in +{ + environment.systemPackages = [ pkgs.wireguard-tools.out ]; + networking.wg-quick.interfaces = listToAttrs ( + map (f: rec { name = head (splitString "." f); value = { - autostart = - if (name == "au-syd-wg-101") - then true - else false; + autostart = if (name == "au-syd-wg-101") then true else false; configFile = builtins.toString ../../mullvad/${f}; }; - }) - (getFiles - ../../mullvad)); + }) (getFiles ../../mullvad) + ); # listToAttrs (map ({ # name, # value, diff --git a/system/modules/network.nix b/system/modules/network.nix index 04893dd..bd64ddf 100644 --- a/system/modules/network.nix +++ b/system/modules/network.nix @@ -1,4 +1,5 @@ -{pkgs,...}: { +{ ... }: +{ # imports = [ # ./mullvad.nix # ]; @@ -6,7 +7,11 @@ 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"]; + fallbackDns = [ + "103.1.206.179" + "168.138.8.38" + "168.138.12.137" + ]; dnssec = "false"; }; services.mullvad-vpn.enable = true; diff --git a/system/modules/niri.nix b/system/modules/niri.nix index 1dbc393..71c63d0 100644 --- a/system/modules/niri.nix +++ b/system/modules/niri.nix @@ -1,19 +1,23 @@ { pkgs, - lib, mainUser, ... -}: { +}: +{ services.greetd = { enable = true; restart = false; - settings = let session = { - command = "niri-session"; - user = "${mainUser}"; - }; in { - default_session = session; - initial_session = session; - }; + settings = + let + session = { + command = "niri-session"; + user = "${mainUser}"; + }; + in + { + default_session = session; + initial_session = session; + }; }; programs.niri = { enable = true; diff --git a/system/modules/nix-meta.nix b/system/modules/nix-meta.nix index 9e4a3d4..291d6c7 100644 --- a/system/modules/nix-meta.nix +++ b/system/modules/nix-meta.nix @@ -1,8 +1,11 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ environment.systemPackages = with pkgs; [ - # nixd home-manager cachix - alejandra + nixfmt-rfc-style + nil + statix + deadnix ]; } diff --git a/system/modules/sound.nix b/system/modules/sound.nix index 888fa8d..83aac05 100644 --- a/system/modules/sound.nix +++ b/system/modules/sound.nix @@ -1,4 +1,5 @@ -{...}: { +_: +{ security.rtkit.enable = true; services.pipewire = { enable = true; diff --git a/system/modules/stable-diffusion.nix b/system/modules/stable-diffusion.nix index 999a5de..bfabd66 100644 --- a/system/modules/stable-diffusion.nix +++ b/system/modules/stable-diffusion.nix @@ -1,10 +1,8 @@ { - lib, - pkgs, stable-diffusion, - automatic-webui, ... -}: { +}: +{ systemd.services.stable-diffusion = { description = "stable diffusion + AUTOMATIC1111 ui"; serviceConfig = { diff --git a/system/modules/sydney.nix b/system/modules/sydney.nix index ce22163..7e51e93 100644 --- a/system/modules/sydney.nix +++ b/system/modules/sydney.nix @@ -1,6 +1,7 @@ -{...}: { +_: +{ time.timeZone = "Australia/Sydney"; time.hardwareClockInLocalTime = false; i18n.defaultLocale = "en_AU.UTF-8"; - i18n.supportedLocales = ["en_AU.UTF-8/UTF-8"]; + i18n.supportedLocales = [ "en_AU.UTF-8/UTF-8" ]; } diff --git a/system/modules/systemdboot.nix b/system/modules/systemdboot.nix index eeef2c4..7d17942 100644 --- a/system/modules/systemdboot.nix +++ b/system/modules/systemdboot.nix @@ -1,4 +1,5 @@ -{...}: { +_: +{ boot.loader.systemd-boot.consoleMode = "max"; boot.loader.timeout = 3; boot.loader.systemd-boot.enable = true; diff --git a/system/modules/term.nix b/system/modules/term.nix index 967c56e..8d2cf08 100644 --- a/system/modules/term.nix +++ b/system/modules/term.nix @@ -1,13 +1,15 @@ -{pkgs, ...}: let +{ pkgs, ... }: +let inherit (pkgs) murex zsh elvish; -in { - environment.pathsToLink = ["/share/zsh"]; +in +{ + environment.pathsToLink = [ "/share/zsh" ]; programs.zsh.enable = true; environment.systemPackages = [ murex elvish ]; - environment.shells = [murex]; + environment.shells = [ murex ]; users.defaultUserShell = murex; # users.defaultUserShell = zsh; console = { diff --git a/system/quiver.nix b/system/quiver.nix index e502826..bc95449 100644 --- a/system/quiver.nix +++ b/system/quiver.nix @@ -2,15 +2,17 @@ config, lib, pkgs, - mainUser, - inputs, ... -}: { +}: +{ imports = [ ./configuration.nix ]; - services.ollama.enable = true; + services.ollama = { + enable = true; + user = "ollama"; + }; system.stateVersion = "22.11"; # Did you read the comment? @@ -24,9 +26,17 @@ ]; }; - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usbcore" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-amd" "i2c-dev"]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "usbcore" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ + "kvm-amd" + "i2c-dev" + ]; boot.kernelParams = [ "mitigations=off" # "acpi_enforce_resources=lax" @@ -38,7 +48,8 @@ "vt.global_cursor_default=0" ]; - boot.kernelPackages = pkgs.linuxPackages_xanmod_latest; + boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linuxPackages_cachyos; + # pkgs.linuxPackages_xanmod_latest; boot.supportedFilesystems = { ntfs = true; btrfs = true; @@ -53,7 +64,10 @@ hardware.cpu.amd.updateMicrocode = true; - environment.pathsToLink = ["/share/xdg-desktop-portal" "/share/applications"]; + environment.pathsToLink = [ + "/share/xdg-desktop-portal" + "/share/applications" + ]; environment.sessionVariables = { NIXOS_OZONE_WL = "1"; # ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=5"; @@ -66,7 +80,7 @@ EDITOR = "hx"; }; - nix.settings.trusted-users = ["bolt"]; + nix.settings.trusted-users = [ "bolt" ]; virtualisation.lxc = { unprivilegedContainers = true; @@ -82,7 +96,7 @@ }; }; - services.xserver.videoDrivers = ["nvidia"]; + services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia = { package = config.boot.kernelPackages.nvidiaPackages.latest; modesetting.enable = true; @@ -108,19 +122,15 @@ # motherboard = "amd"; # }; - hardware.ckb-next = { - enable = true; - # package = inputs.nixpkgs-stable.legacyPackages.x86_64-linux.ckb-next; - }; - + hardware.ckb-next.enable = true; environment.systemPackages = builtins.attrValues { - inherit - (pkgs) + inherit (pkgs) wl-clipboard wl-clipboard-x11 xclip ; }; + programs.fuse.userAllowOther = true; fileSystems = { "/" = { @@ -136,18 +146,34 @@ "/data" = { device = "/dev/disk/by-uuid/39D4F78C658E8B56"; fsType = "ntfs"; - options = ["rw" "uid=1000" "gid=100"]; + options = [ + "rw" + "uid=1000" + "gid=100" + ]; }; }; swapDevices = [ - {device = "/dev/disk/by-uuid/9c006925-e0e9-4165-bc0c-508ae2d1bfce";} + { device = "/dev/disk/by-uuid/9c006925-e0e9-4165-bc0c-508ae2d1bfce"; } ]; # networking.nftables.enable = true; networking.firewall = { # allowedUDPPorts = [1900]; # allowedTCPPorts = [8200 2234]; - allowedTCPPorts = [2234]; + allowedTCPPorts = [ 2234 ]; + }; + + services.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/system/servers/atagen-vps/reflector.nix b/system/servers/atagen-vps/reflector.nix index 9698995..585c07d 100644 --- a/system/servers/atagen-vps/reflector.nix +++ b/system/servers/atagen-vps/reflector.nix @@ -2,11 +2,11 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). { - lib, config, pkgs, ... -}: let +}: +let wekan-compose = pkgs.fetchurl { url = "https://github.com/wekan/wekan/raw/v6.68/docker-compose.yml"; sha256 = "sha256-gLZ8bZZ8ZMo1NGz3ooIgXRH6JuMoEMp+to7lfqAvc6E="; @@ -18,18 +18,15 @@ # 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" {} '' + 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 ''; - foswiki-compose = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/timlegge/docker-foswiki/master/docker-compose.1-simple.yml"; - sha256 = "sha256-XqGWGTZ/URKsIdDEEpBQUK7xoIdZ164lRhHEiWdnKpM="; - }; -in { +in +{ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix @@ -41,7 +38,10 @@ in { # "nix-community" # ]; - nix.settings.experimental-features = ["flakes" "nix-command"]; + nix.settings.experimental-features = [ + "flakes" + "nix-command" + ]; # systemd.services.NetworkManager-wait-online.enable = false; # Use the GRUB 2 boot loader. @@ -58,8 +58,8 @@ in { # 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; []; + 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" ]; @@ -113,7 +113,11 @@ in { enable = true; serverUrl = "https://net.atagen.co"; dns = { - nameservers = ["103.1.206.179" "168.138.8.38" "168.138.12.137"]; + nameservers = [ + "103.1.206.179" + "168.138.8.38" + "168.138.12.137" + ]; magicDns = true; }; }; @@ -147,27 +151,33 @@ in { isSystemUser = true; createHome = true; group = "ci"; - extraGroups = ["docker" "wheel"]; + extraGroups = [ + "docker" + "wheel" + ]; }; - users.groups.ci = {}; + users.groups.ci = { }; users.users.ci-agent = { isSystemUser = true; createHome = true; group = "ci"; - extraGroups = ["docker" "wheel"]; + extraGroups = [ + "docker" + "wheel" + ]; }; - users.groups.ci = {}; + users.groups.ci = { }; users.users.dufs = { isSystemUser = true; createHome = true; group = "dufs"; }; - users.groups.dufs = {}; + users.groups.dufs = { }; systemd.services.woodpecker-server = { - wantedBy = ["multi-user.target"]; + wantedBy = [ "multi-user.target" ]; description = "woodpecker CI/CD server"; serviceConfig = { Environment = [ @@ -191,7 +201,7 @@ in { }; systemd.services.woodpecker-agent = { - wantedBy = ["multi-user.target"]; + wantedBy = [ "multi-user.target" ]; description = "woodpecker CI/CD agent"; serviceConfig = { Environment = [ @@ -218,9 +228,12 @@ in { # }; systemd.services.wekan-rhizome = { - wantedBy = ["multi-user.target"]; - after = ["network.target" "docker.service"]; - requires = ["docker.service"]; + wantedBy = [ "multi-user.target" ]; + after = [ + "network.target" + "docker.service" + ]; + requires = [ "docker.service" ]; description = "wekan kanban board for rhizomers"; serviceConfig = { Restart = "always"; @@ -231,8 +244,8 @@ in { }; systemd.services.dufs = { - wantedBy = ["multi-user.target"]; - after = ["network.target"]; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; description = "dufs webdav server"; serviceConfig = { User = "dufs"; @@ -258,7 +271,7 @@ in { enable = true; virtualHosts = { "atagen.co" = { - serverAliases = ["www.atagen.co"]; + serverAliases = [ "www.atagen.co" ]; extraConfig = '' respond "i live.. again" ''; @@ -318,10 +331,19 @@ in { networking.firewall = { enable = true; - trustedInterfaces = ["tailscale0"]; + trustedInterfaces = [ "tailscale0" ]; checkReversePath = "loose"; - allowedTCPPorts = [80 443 6660]; - allowedUDPPorts = [80 443 41641 6660]; + allowedTCPPorts = [ + 80 + 443 + 6660 + ]; + allowedUDPPorts = [ + 80 + 443 + 41641 + 6660 + ]; }; # Copy the NixOS configuration file and link it from the resulting system diff --git a/system/servers/rhizome-vps/configuration.nix b/system/servers/rhizome-vps/configuration.nix index 812d7b2..7c65bf0 100644 --- a/system/servers/rhizome-vps/configuration.nix +++ b/system/servers/rhizome-vps/configuration.nix @@ -2,30 +2,33 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running `nixos-help`). { - config, pkgs, lib, ... -}: { +}: +{ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix ]; - nix.settings.experimental-features = ["nix-command" "flakes"]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; nix.extraOptions = '' keep-outputs = true keep-derivations = true ''; - environment.pathsToLink = ["/share/zsh"]; + environment.pathsToLink = [ "/share/zsh" ]; programs.zsh.enable = true; users.defaultUserShell = pkgs.zsh; users.users.felix = { isSystemUser = true; group = "www"; - extraGroups = ["docker"]; + extraGroups = [ "docker" ]; }; users.users.spore = { @@ -34,14 +37,18 @@ createHome = true; useDefaultShell = true; group = "www"; - extraGroups = ["docker"]; + extraGroups = [ "docker" ]; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL9VRcCnmjCyV7DpCm8ir3+xPTbyMDBJhgSkhpmdFL5d spore@server.rhizome.tf" ]; }; users.groups.www = { - members = ["acme" "felix" "spore"]; + members = [ + "acme" + "felix" + "spore" + ]; }; boot.loader.grub.enable = true; @@ -54,7 +61,7 @@ users.users.rhizome = { isNormalUser = true; - extraGroups = ["wheel"]; # Enable ‘sudo’ for the user. + 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" @@ -65,17 +72,17 @@ isSystemUser = true; createHome = true; group = "ci"; - extraGroups = ["docker"]; + extraGroups = [ "docker" ]; }; users.users.ci-agent = { isSystemUser = true; createHome = true; group = "ci"; - extraGroups = ["docker"]; + extraGroups = [ "docker" ]; }; - users.groups.ci = {}; + users.groups.ci = { }; virtualisation = { docker.enable = true; @@ -137,7 +144,7 @@ }; systemd.services.woodpecker-server = { - wantedBy = ["multi-user.target"]; + wantedBy = [ "multi-user.target" ]; description = "woodpecker CI/CD server"; serviceConfig = { Environment = [ @@ -161,7 +168,7 @@ }; systemd.services.woodpecker-agent = { - wantedBy = ["multi-user.target"]; + wantedBy = [ "multi-user.target" ]; description = "woodpecker CI/CD agent"; serviceConfig = { Environment = [ @@ -175,7 +182,7 @@ }; systemd.services.felix = { - wantedBy = ["multi-user.target"]; + 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''; @@ -250,8 +257,18 @@ permitRootLogin = "no"; }; - networking.firewall.allowedTCPPorts = [22 80 443 5539 5559 6660]; - networking.firewall.allowedUDPPorts = [443 6660]; + networking.firewall.allowedTCPPorts = [ + 22 + 80 + 443 + 5539 + 5559 + 6660 + ]; + networking.firewall.allowedUDPPorts = [ + 443 + 6660 + ]; security.acme = { acceptTerms = true; diff --git a/system/servers/rhizome-vps/flake.nix b/system/servers/rhizome-vps/flake.nix index 89a37a9..677b59a 100644 --- a/system/servers/rhizome-vps/flake.nix +++ b/system/servers/rhizome-vps/flake.nix @@ -21,33 +21,33 @@ }; }; - outputs = { - self, - nixpkgs, - home-manager, - nix-index-database, - ... - } @ inputs: let - inherit (self) outputs; - forAllSystems = nixpkgs.lib.genAttrs [ - "x86_64-linux" - ]; - 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 + 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 index 7c8418f..7564564 100644 --- a/system/servers/rhizome-vps/hardware-configuration.nix +++ b/system/servers/rhizome-vps/hardware-configuration.nix @@ -2,25 +2,29 @@ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. { - config, lib, - pkgs, - modulesPath, ... -}: { - imports = []; +}: +{ + imports = [ ]; - boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk"]; - boot.initrd.kernelModules = []; - boot.kernelModules = []; - boot.extraModulePackages = []; + 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 = []; + 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 diff --git a/system/servers/rhizome-vps/rhizome.nix b/system/servers/rhizome-vps/rhizome.nix index ecd7d6a..72acd99 100644 --- a/system/servers/rhizome-vps/rhizome.nix +++ b/system/servers/rhizome-vps/rhizome.nix @@ -1,11 +1,8 @@ { - inputs, - outputs, - lib, - config, pkgs, ... -}: { +}: +{ home.packages = with pkgs; [ lazygit alejandra diff --git a/util/create.nix b/util/create.nix index 8125a32..46e8f60 100644 --- a/util/create.nix +++ b/util/create.nix @@ -3,16 +3,19 @@ home-manager, system, inputs, - outputs, + self, sharedModules, ... -}: { - systems = definitions: - nixpkgs.lib.mapAttrs (name: info: +}: +{ + systems = + definitions: + nixpkgs.lib.mapAttrs ( + name: info: nixpkgs.lib.nixosSystem { inherit system; specialArgs = { - inherit inputs outputs; + inherit inputs self; mainUser = info.user; }; modules = @@ -23,18 +26,17 @@ home-manager = { useGlobalPkgs = true; extraSpecialArgs = { - inherit inputs outputs; + inherit inputs self; mainUser = info.user; }; - users.${info.user}.imports = - [ - ../home/${info.user}.nix - ] - ++ info.hmImports or []; + users.${info.user}.imports = [ + ../home/${info.user}.nix + ] ++ info.hmImports or [ ]; }; } ] - ++ info.imports or [] + ++ info.imports or [ ] ++ sharedModules; - }) definitions; + } + ) definitions; } diff --git a/util/gtk-theme.nix b/util/gtk-theme.nix index f1b400e..8f2db86 100644 --- a/util/gtk-theme.nix +++ b/util/gtk-theme.nix @@ -1,65 +1,70 @@ -{pkgs}: {palette}: let - rendersvg = pkgs.runCommand "rendersvg" {} '' +{ pkgs }: +{ palette }: +let + rendersvg = pkgs.runCommand "rendersvg" { } '' mkdir -p $out/bin ln -s ${pkgs.resvg}/bin/resvg $out/bin/rendersvg ''; in - pkgs.stdenv.mkDerivation rec { - name = "generated-gtk-theme-nix-rice"; - src = pkgs.fetchFromGitHub { - owner = "nana-4"; - repo = "materia-theme"; - rev = "d7f59a37ef51f893c28b55dc344146e04b2cd52c"; - sha256 = "sha256-PnpFAmKEpfg3wBwShLYviZybWQQltcw7fpsQkTUZtww="; - }; - buildInputs = with pkgs; [ - sassc - bc - which - rendersvg - meson - ninja - nodePackages.sass - gtk4.dev - optipng - ]; - phases = ["unpackPhase" "installPhase"]; - installPhase = '' - HOME=/build - chmod 777 -R . - patchShebangs . - mkdir -p $out/share/themes - mkdir bin - sed -e 's/handle-horz-.*//' -e 's/handle-vert-.*//' -i ./src/gtk-2.0/assets.txt +pkgs.stdenv.mkDerivation rec { + name = "generated-gtk-theme-nix-rice"; + src = pkgs.fetchFromGitHub { + owner = "nana-4"; + repo = "materia-theme"; + rev = "d7f59a37ef51f893c28b55dc344146e04b2cd52c"; + sha256 = "sha256-PnpFAmKEpfg3wBwShLYviZybWQQltcw7fpsQkTUZtww="; + }; + buildInputs = with pkgs; [ + sassc + bc + which + rendersvg + meson + ninja + nodePackages.sass + gtk4.dev + optipng + ]; + phases = [ + "unpackPhase" + "installPhase" + ]; + installPhase = '' + HOME=/build + chmod 777 -R . + patchShebangs . + mkdir -p $out/share/themes + mkdir bin + sed -e 's/handle-horz-.*//' -e 's/handle-vert-.*//' -i ./src/gtk-2.0/assets.txt - cat > /build/gtk-colors << EOF - BTN_BG=${palette.util.bg} - BTN_FG=${palette.bright.yellow} - FG=${palette.util.fg} - BG=${palette.util.bg} - HDR_BTN_BG=${palette.util.bg} - HDR_BTN_FG=${palette.util.fg} - ACCENT_BG=${palette.normal.cyan} - ACCENT_FG=${palette.normal.yellow} - HDR_FG=${palette.bright.yellow} - HDR_BG=${palette.util.bg} - MATERIA_SURFACE=${palette.normal.black} - MATERIA_VIEW=${palette.bright.black} - MENU_BG=${palette.util.bg} - MENU_FG=${palette.util.fg} - SEL_BG=${palette.normal.yellow} - SEL_FG=${palette.normal.cyan} - TXT_BG=${palette.util.bg} - TXT_FG=${palette.util.fg} - WM_BORDER_FOCUS=${palette.normal.yellow} - WM_BORDER_UNFOCUS=${palette.normal.black} - UNITY_DEFAULT_LAUNCHER_STYLE=False - NAME="nix-rice" - MATERIA_STYLE_COMPACT=False - EOF + cat > /build/gtk-colors << EOF + BTN_BG=${palette.util.bg} + BTN_FG=${palette.bright.yellow} + FG=${palette.util.fg} + BG=${palette.util.bg} + HDR_BTN_BG=${palette.util.bg} + HDR_BTN_FG=${palette.util.fg} + ACCENT_BG=${palette.normal.cyan} + ACCENT_FG=${palette.normal.yellow} + HDR_FG=${palette.bright.yellow} + HDR_BG=${palette.util.bg} + MATERIA_SURFACE=${palette.normal.black} + MATERIA_VIEW=${palette.bright.black} + MENU_BG=${palette.util.bg} + MENU_FG=${palette.util.fg} + SEL_BG=${palette.normal.yellow} + SEL_FG=${palette.normal.cyan} + TXT_BG=${palette.util.bg} + TXT_FG=${palette.util.fg} + WM_BORDER_FOCUS=${palette.normal.yellow} + WM_BORDER_UNFOCUS=${palette.normal.black} + UNITY_DEFAULT_LAUNCHER_STYLE=False + NAME="nix-rice" + MATERIA_STYLE_COMPACT=False + EOF - echo "Changing colours:" - ./change_color.sh -o nix-rice /build/gtk-colors -i False -t "$out/share/themes" - chmod 555 -R . - ''; - } + echo "Changing colours:" + ./change_color.sh -o nix-rice /build/gtk-colors -i False -t "$out/share/themes" + chmod 555 -R . + ''; +} diff --git a/util/overlay.nix b/util/overlay.nix index 94c6a02..b1d072c 100644 --- a/util/overlay.nix +++ b/util/overlay.nix @@ -1,49 +1,18 @@ { inputs, - lib, ... -}: { +}: +{ rice = import ./rice.nix; - murex-jump = inputs.murex-jump.overlays.murex-jump; - murex-starship = inputs.murex-starship.overlays.murex-starship; - comfyui = inputs.comfyui.overlays.comfyui; - comfyui-plugins = inputs.comfyui-plugins.overlays.comfyui-plugins; - murex = final: prev: { + inherit (inputs.murex-jump.overlays) murex-jump; + inherit (inputs.murex-starship.overlays) murex-starship; + inherit (inputs.comfyui.overlays) comfyui; + inherit (inputs.comfyui-plugins.overlays) comfyui-plugins; + murex = _final: prev: { murex = prev.murex.overrideAttrs { version = "dev-${builtins.toString inputs.murex.lastModifiedDate}"; src = inputs.murex; - vendorHash = "sha256-NIhg8D8snCNxpb3i2JG5tLcZteYBCGN4QbOowG/vgJE="; + vendorHash = "sha256-+V9rvWTtMtszR8JmTrntEy+CsAZsKYRblHsp6iaPuUs="; }; }; - # sirula = let - # src = inputs.sirula; - # in - # final: prev: { - # sirula = - # (prev.sirula.override (old: { - # rustPlatform = - # old.rustPlatform - # // { - # buildRustPackage = args: - # old.rustPlatform.buildRustPackage (args - # // { - # inherit src; - # cargoHash = prev.lib.fakeHash; - # cargoSha256 = prev.lib.fakeHash; - # cargoLock = { - # lockFile = "${inputs.sirula}" + /Cargo.lock; - # }; - # }); - # }; - # })) - # .overrideAttrs (oldAttrs: { - # version = "1.0.0-${builtins.toString inputs.sirula.lastModifiedDate}"; - # inherit src; - # cargoDeps = oldAttrs.cargoDeps.overrideAttrs (prev.lib.const { - # inherit src; - # outputHash = prev.lib.fakeHash; - # outputHashMode = "recursive"; - # }); - # }); - # }; } diff --git a/util/rice.nix b/util/rice.nix index 5f4befd..b886530 100644 --- a/util/rice.nix +++ b/util/rice.nix @@ -1,43 +1,43 @@ -final: prev: let +final: prev: +let inherit (prev.lib.nix-rice) kitty-themes; - inherit (prev.lib.nix-rice.palette) toRGBShortHex toRgbHex; + inherit (prev.lib.nix-rice.palette) toRGBShortHex; # theme = kitty-themes.parseTheme ./op.pal; theme = kitty-themes.parseTheme ./pal.conf; - # theme = kitty-themes.getThemeByName "everforest_dark_hard"; -in { +in +# theme = kitty-themes.getThemeByName "everforest_dark_hard"; +{ rice = rec { - palette = - { - 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; - cursor = theme.cursor; - # url = theme.url_color; - }; - } - // theme; + palette = { + 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; + }; + } // theme; fonts = rec { sans = { @@ -81,7 +81,7 @@ in { gtk-theme = { name = "nix-rice"; - package = prev.callPackage ./gtk-theme.nix {} {palette = toRGBShortHex final.rice.palette;}; + package = prev.callPackage ./gtk-theme.nix { } { palette = toRGBShortHex final.rice.palette; }; }; borders = { @@ -92,7 +92,7 @@ in { }; bg = { - image = prev.callPackage ./wallpaper.nix {} { + image = prev.callPackage ./wallpaper.nix { } { palette = toRGBShortHex final.rice.palette; wallpaper = builtins.path rec { name = "wallpaper.jpg"; @@ -104,8 +104,8 @@ in { cursor = { package = prev.afterglow-cursors-recolored.override { - themeVariants = ["Dracula"]; - draculaColorVariants = ["Orange"]; + themeVariants = [ "Dracula" ]; + draculaColorVariants = [ "Orange" ]; }; name = "Afterglow-Recolored-Dracula-Orange"; }; @@ -115,7 +115,7 @@ in { font = "${fonts.sans.package}/share/fonts/truetype/InriaSans-Regular.ttf"; theme = "colorful_loop"; themePackages = [ - (prev.pkgs.adi1090x-plymouth-themes.override {selected_themes = ["colorful_loop"];}) + (prev.pkgs.adi1090x-plymouth-themes.override { selected_themes = [ "colorful_loop" ]; }) ]; }; }; # /rice diff --git a/util/wallpaper.nix b/util/wallpaper.nix index abaf81d..d0cdd0e 100644 --- a/util/wallpaper.nix +++ b/util/wallpaper.nix @@ -1,20 +1,26 @@ -{pkgs}: { +{ pkgs }: +{ palette, wallpaper, -}: let - str_pal = with pkgs.lib; concatStringsSep " " (builtins.foldl' (acc: el: acc ++ (attrValues el)) [] [palette.normal palette.bright palette.util]); +}: +let + str_pal = + with pkgs.lib; + concatStringsSep " " ( + builtins.foldl' (acc: el: acc ++ (attrValues el)) [ ] [ palette.normal palette.bright palette.util ] + ); in - pkgs.stdenv.mkDerivation rec { - name = "generated-wallpaper.png"; - src = wallpaper; - buildInputs = [ - pkgs.lutgen - ]; +pkgs.stdenv.mkDerivation rec { + name = "generated-wallpaper.png"; + src = wallpaper; + buildInputs = [ + pkgs.lutgen + ]; - phases = ["installPhase"]; + phases = [ "installPhase" ]; - installPhase = '' - echo -e "Generating wallpaper from ${wallpaper} using palette:\n${str_pal}.." - ${pkgs.lib.getExe pkgs.lutgen} apply --lum 0.8 -l 10 -s 128 -n 8 -o $out ${wallpaper} -- ${str_pal} - ''; - } + installPhase = '' + echo -e "Generating wallpaper from ${wallpaper} using palette:\n${str_pal}.." + ${pkgs.lib.getExe pkgs.lutgen} apply --lum 0.8 -l 10 -s 128 -n 8 -o $out ${wallpaper} -- ${str_pal} + ''; +}