From 1df8d0282211525b3290dee68bf7919086fbfee6 Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Tue, 15 Oct 2024 10:04:58 +0200 Subject: [PATCH 01/21] feat(btrfs)!: no lvm --- .../disko/btrfs-persistence-swapfile.nix | 64 +++++++++++++++++++ host/features/impermanence.nix | 2 +- host/laptop/default.nix | 2 +- 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 host/features/disko/btrfs-persistence-swapfile.nix diff --git a/host/features/disko/btrfs-persistence-swapfile.nix b/host/features/disko/btrfs-persistence-swapfile.nix new file mode 100644 index 0000000..1ee30e7 --- /dev/null +++ b/host/features/disko/btrfs-persistence-swapfile.nix @@ -0,0 +1,64 @@ +# run with: sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko ./btrfs-persistence-swapfile.nix --arg device '"eg. /dev/sda"' --arg swap 'number' +{ + device, + swap ? 4, + ... +}: { + disko.devices = { + disk = { + main = { + inherit device; + type = "disk"; + content = { + type = "gpt"; + partitions = { + esp = { + priority = 1; + name = "boot"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = ["umask=0077"]; + }; + }; + + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = ["-f"]; + + subvolumes = { + "/root" = { + mountpoint = "/"; + }; + + "/swap" = { + mountpoint = "/.swapvol"; + swap.swapfile.size = "${builtins.toString swap}G"; + }; + + "/nix" = { + mountOptions = ["subvol=nix" "compress=zstd" "noatime"]; + mountpoint = "/nix"; + }; + + "/persist" = { + mountOptions = ["subvol=persist" "compress=zstd"]; + mountpoint = "/persist"; + }; + }; + + mountpoint = "/"; + swap.swapfile.size = "${builtins.toString swap}G"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/host/features/impermanence.nix b/host/features/impermanence.nix index 6b83da4..8a4758f 100644 --- a/host/features/impermanence.nix +++ b/host/features/impermanence.nix @@ -10,7 +10,7 @@ boot.initrd.postDeviceCommands = lib.mkAfter '' mkdir /btrfs_tmp - mount /dev/root_vg/root /btrfs_tmp + mount /dev/root /btrfs_tmp if [[ -e /btrfs_tmp/root ]]; then mkdir -p /btrfs_tmp/old_roots timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S") diff --git a/host/laptop/default.nix b/host/laptop/default.nix index 6250ef2..c51943a 100755 --- a/host/laptop/default.nix +++ b/host/laptop/default.nix @@ -7,7 +7,7 @@ ./hardware-configuration.nix ./secrets.nix - (import ../features/disko/device-btrfs-persistence.nix { + (import ../features/disko/btrfs-persistence-swapfile.nix { device = "/dev/nvme0n1"; swap = 15; }) From e5a7985d2acef4ff721be19def734e398127caf0 Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Tue, 15 Oct 2024 10:06:55 +0200 Subject: [PATCH 02/21] feat(shell): better install script and disco in shell --- shell.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shell.nix b/shell.nix index b7523c6..f05b526 100644 --- a/shell.nix +++ b/shell.nix @@ -57,6 +57,11 @@ { name = "install-remote"; command = '' + if [ ! -f ./host/$1/ssh_host_ed25519_key ]; then + echo "missing host key ./host/$1/ssh_host_ed25519_key" + exit 1 + fi + temp=$(mktemp -d) cleanup() { @@ -78,7 +83,7 @@ in pkgs.mkShell { buildInputs = - [pkgs.nh pkgs.ssh-to-age pkgs.sops pkgs.nixos-anywhere] + [pkgs.nh pkgs.ssh-to-age pkgs.sops pkgs.nixos-anywhere pkgs.disko] ++ (map (alias: pkgs.writeShellScriptBin alias.name alias.command) aliases); shellHook = '' printf "\e[33m From a4df008dee755b2f441bd3a638452cccb4f1a504 Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Fri, 18 Oct 2024 20:45:17 +0200 Subject: [PATCH 03/21] feat(disko): version bump --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 15fa9e8..f657b9b 100755 --- a/flake.lock +++ b/flake.lock @@ -143,11 +143,11 @@ ] }, "locked": { - "lastModified": 1720056646, - "narHash": "sha256-BymcV4HWtx2VFuabDCM4/nEJcfivCx0S02wUCz11mAY=", + "lastModified": 1729099656, + "narHash": "sha256-VftVIg7UXTy1bq+tzi1aVYOWl7PQ35IpjW88yMYjjpc=", "owner": "nix-community", "repo": "disko", - "rev": "64679cd7f318c9b6595902b47d4585b1d51d5f9e", + "rev": "d7d57edb72e54891fa67a6f058a46b2bb405663b", "type": "github" }, "original": { From 0c68dcd207b9bca152a744d52de8f1688a871c4d Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Sat, 19 Oct 2024 13:04:52 +0200 Subject: [PATCH 04/21] feat: update --- flake.lock | 255 ++++++++++++++++++----------------- host/features/networking.nix | 8 +- 2 files changed, 134 insertions(+), 129 deletions(-) diff --git a/flake.lock b/flake.lock index f657b9b..e6d1208 100755 --- a/flake.lock +++ b/flake.lock @@ -34,30 +34,14 @@ "type": "github" } }, - "base16-foot": { - "flake": false, - "locked": { - "lastModified": 1696725948, - "narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=", - "owner": "tinted-theming", - "repo": "base16-foot", - "rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce", - "type": "github" - }, - "original": { - "owner": "tinted-theming", - "repo": "base16-foot", - "type": "github" - } - }, "base16-helix": { "flake": false, "locked": { - "lastModified": 1696727917, - "narHash": "sha256-FVrbPk+NtMra0jtlC5oxyNchbm8FosmvXIatkRbYy1g=", + "lastModified": 1725860795, + "narHash": "sha256-Z2o8VBPW3I+KKTSfe25kskz0EUj7MpUh8u355Z1nVsU=", "owner": "tinted-theming", "repo": "base16-helix", - "rev": "dbe1480d99fe80f08df7970e471fac24c05f2ddb", + "rev": "7f795bf75d38e0eea9fed287264067ca187b88a9", "type": "github" }, "original": { @@ -66,38 +50,6 @@ "type": "github" } }, - "base16-kitty": { - "flake": false, - "locked": { - "lastModified": 1665001328, - "narHash": "sha256-aRaizTYPpuWEcvoYE9U+YRX+Wsc8+iG0guQJbvxEdJY=", - "owner": "kdrag0n", - "repo": "base16-kitty", - "rev": "06bb401fa9a0ffb84365905ffbb959ae5bf40805", - "type": "github" - }, - "original": { - "owner": "kdrag0n", - "repo": "base16-kitty", - "type": "github" - } - }, - "base16-tmux": { - "flake": false, - "locked": { - "lastModified": 1696725902, - "narHash": "sha256-wDPg5elZPcQpu7Df0lI5O8Jv4A3T6jUQIVg63KDU+3Q=", - "owner": "tinted-theming", - "repo": "base16-tmux", - "rev": "c02050bebb60dbb20cb433cd4d8ce668ecc11ba7", - "type": "github" - }, - "original": { - "owner": "tinted-theming", - "repo": "base16-tmux", - "type": "github" - } - }, "base16-vim": { "flake": false, "locked": { @@ -143,11 +95,11 @@ ] }, "locked": { - "lastModified": 1729099656, - "narHash": "sha256-VftVIg7UXTy1bq+tzi1aVYOWl7PQ35IpjW88yMYjjpc=", + "lastModified": 1729281548, + "narHash": "sha256-MuojlSnwAJAwfhgmW8ZtZrwm2Sko4fqubCvReqbUzYw=", "owner": "nix-community", "repo": "disko", - "rev": "d7d57edb72e54891fa67a6f058a46b2bb405663b", + "rev": "a6a3179ddf396dfc28a078e2f169354d0c137125", "type": "github" }, "original": { @@ -165,11 +117,11 @@ }, "locked": { "dir": "pkgs/firefox-addons", - "lastModified": 1720329613, - "narHash": "sha256-lXKlKRf0ri+VEq+4zFTkPENXEUhULZ8oDV28piSKNRo=", + "lastModified": 1729321532, + "narHash": "sha256-3/d/mbLQhrkE1qK2Ut/mrMElE6fP9t6ITJoRQ6F+D7o=", "owner": "rycee", "repo": "nur-expressions", - "rev": "8beedc684423d458770eda7ff86e34e8e714ab41", + "rev": "70087c8c6e491dcc0bbff459073b480b1a72ac1c", "type": "gitlab" }, "original": { @@ -275,11 +227,11 @@ "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { - "lastModified": 1714641030, - "narHash": "sha256-yzcRNDoyVP7+SCNX0wmuDju1NUCt8Dz9+lyUXEI0dbI=", + "lastModified": 1726153070, + "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e", + "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", "type": "github" }, "original": { @@ -323,7 +275,10 @@ }, "flake-utils_3": { "inputs": { - "systems": "systems_2" + "systems": [ + "stylix", + "systems" + ] }, "locked": { "lastModified": 1710146030, @@ -344,11 +299,11 @@ "systems": "systems_3" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -487,11 +442,11 @@ ] }, "locked": { - "lastModified": 1720327769, - "narHash": "sha256-kAsg3Lg4YKKpGw+f1W2s5hzjP8B0y/juowvjK8utIag=", + "lastModified": 1729321331, + "narHash": "sha256-KVyQq+ez/oB30/WbdNgVD8g/bda34z8NiU187QKQb74=", "owner": "nix-community", "repo": "home-manager", - "rev": "6b7ce96f34b324e4e104abc30d06955d216bac71", + "rev": "122f70545b29ccb922e655b08acfe05bfb44ec68", "type": "github" }, "original": { @@ -530,11 +485,11 @@ ] }, "locked": { - "lastModified": 1715930644, - "narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=", + "lastModified": 1724435763, + "narHash": "sha256-UNky3lJNGQtUEXT2OY8gMxejakSWPTfWKvpFkpFlAfM=", "owner": "nix-community", "repo": "home-manager", - "rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d", + "rev": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be", "type": "github" }, "original": { @@ -545,11 +500,11 @@ }, "impermanence": { "locked": { - "lastModified": 1719091691, - "narHash": "sha256-AxaLX5cBEcGtE02PeGsfscSb/fWMnyS7zMWBXQWDKbE=", + "lastModified": 1729068498, + "narHash": "sha256-C2sGRJl1EmBq0nO98TNd4cbUy20ABSgnHWXLIJQWRFA=", "owner": "nix-community", "repo": "impermanence", - "rev": "23c1f06316b67cb5dabdfe2973da3785cfe9c34a", + "rev": "e337457502571b23e449bf42153d7faa10c0a562", "type": "github" }, "original": { @@ -624,11 +579,11 @@ ] }, "locked": { - "lastModified": 1701153607, - "narHash": "sha256-h+odOVyiGmEERMECoFOj5P7FPiMR8IPRzroFA4sKivg=", + "lastModified": 1728031945, + "narHash": "sha256-NRkLjdMtVfC6dD1gEbYZWFEtbmC2xfD6ft1IP7l76Vw=", "owner": "Mic92", "repo": "nix-ld", - "rev": "bf5aa84a713c31d95b4307e442e966d6c7fd7ae7", + "rev": "4524c512e8729ccb5a1b9239d01e1474cbf074a2", "type": "github" }, "original": { @@ -667,23 +622,23 @@ }, "nixpkgs-lib_2": { "locked": { - "lastModified": 1714640452, - "narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=", + "lastModified": 1725233747, + "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" } }, "nixpkgs-stable": { "locked": { - "lastModified": 1720282526, - "narHash": "sha256-dudRkHPRivMNOhd04YI+v4sWvn2SnN5ODSPIu5IVbco=", + "lastModified": 1728156290, + "narHash": "sha256-uogSvuAp+1BYtdu6UWuObjHqSbBohpyARXDWqgI12Ss=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "550ac3e955c30fe96dd8b2223e37e0f5d225c927", + "rev": "17ae88b569bb15590549ff478bab6494dde4a907", "type": "github" }, "original": { @@ -695,11 +650,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1720031269, - "narHash": "sha256-rwz8NJZV+387rnWpTYcXaRNvzUSnnF9aHONoJIYmiUQ=", + "lastModified": 1729256560, + "narHash": "sha256-/uilDXvCIEs3C9l73JTACm4quuHUsIHcns1c+cHUJwA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev": "4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0", "type": "github" }, "original": { @@ -710,11 +665,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1720181791, - "narHash": "sha256-i4vJL12/AdyuQuviMMd1Hk2tsGt02hDNhA0Zj1m16N8=", + "lastModified": 1728093190, + "narHash": "sha256-CAZF2NRuHmqTtRTNAruWpHA43Gg2UvuCNEIzabP0l6M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4284c2b73c8bce4b46a6adf23e16d9e2ec8da4bb", + "rev": "e2f08f4d8b3ecb5cf5c9fd9cb2d53bb3c71807da", "type": "github" }, "original": { @@ -726,11 +681,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1714912032, - "narHash": "sha256-clkcOIkg8G4xuJh+1onLG4HPMpbtzdLv4rHxFzgsH9c=", + "lastModified": 1725194671, + "narHash": "sha256-tLGCFEFTB5TaOKkpfw3iYT9dnk4awTP/q4w+ROpMfuw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ee4a6e0f566fe5ec79968c57a9c2c3c25f2cf41d", + "rev": "b833ff01a0d694b910daca6e2ff4a3f26dee478c", "type": "github" }, "original": { @@ -758,11 +713,11 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1721466660, - "narHash": "sha256-pFSxgSZqZ3h+5Du0KvEL1ccDZBwu4zvOil1zzrPNb3c=", + "lastModified": 1726238386, + "narHash": "sha256-3//V84fYaGVncFImitM6lSAliRdrGayZLdxWlpcuGk0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6e14bbce7bea6c4efd7adfa88a40dac750d80100", + "rev": "01f064c99c792715054dc7a70e4c1626dbbec0c3", "type": "github" }, "original": { @@ -774,11 +729,11 @@ }, "nixpkgs_7": { "locked": { - "lastModified": 1715413075, - "narHash": "sha256-FCi3R1MeS5bVp0M0xTheveP6hhcCYfW/aghSTPebYL4=", + "lastModified": 1727686113, + "narHash": "sha256-RG+429Uv2W+X5vdZ8mAngtfC1ppzu28rCWw5R7JC3k0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e4e7a43a9db7e22613accfeb1005cca1b2b1ee0d", + "rev": "ef7226d68ba45b2de3e428e5d4bb4532caffec7b", "type": "github" }, "original": { @@ -790,11 +745,11 @@ }, "nixpkgs_8": { "locked": { - "lastModified": 1706487304, - "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", + "lastModified": 1718428119, + "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "90f456026d284c22b3e3497be980b2e47d0b28ac", + "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5", "type": "github" }, "original": { @@ -880,11 +835,11 @@ ] }, "locked": { - "lastModified": 1721441897, - "narHash": "sha256-gYGX9/22tPNeF7dR6bWN5rsrpU4d06GnQNNgZ6ZiXz0=", + "lastModified": 1726280639, + "narHash": "sha256-YfLRPlFZWrT2oRLNAoqf7G3+NnUTDdlIJk6tmBU7kXM=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "b7996075da11a2d441cfbf4e77c2939ce51506fd", + "rev": "e9f8641c92f26fd1e076e705edb12147c384171d", "type": "github" }, "original": { @@ -895,15 +850,14 @@ }, "rust-overlay_2": { "inputs": { - "flake-utils": "flake-utils_4", "nixpkgs": "nixpkgs_8" }, "locked": { - "lastModified": 1715393623, - "narHash": "sha256-nSUFcUqyTQQ/aYFIB05mpCzytcKvfKMy3ZQAe0fP26A=", + "lastModified": 1727663505, + "narHash": "sha256-83j/GrHsx8GFUcQofKh+PRPz6pz8sxAsZyT/HCNdey8=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "8eb8671512cb0c72c748058506e50c54fb5d8e2b", + "rev": "c2099c6c7599ea1980151b8b6247a8f93e1806ee", "type": "github" }, "original": { @@ -918,11 +872,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1720321395, - "narHash": "sha256-kcI8q9Nh8/CSj0ygfWq1DLckHl8IHhFarL8ie6g7OEk=", + "lastModified": 1728345710, + "narHash": "sha256-lpunY1+bf90ts+sA2/FgxVNIegPDKCpEoWwOPu4ITTQ=", "owner": "Mic92", "repo": "sops-nix", - "rev": "c184aca4db5d71c3db0c8cbfcaaec337a5d065ea", + "rev": "06535d0e3d0201e6a8080dd32dbfde339b94f01b", "type": "github" }, "original": { @@ -935,22 +889,24 @@ "inputs": { "base16": "base16", "base16-fish": "base16-fish", - "base16-foot": "base16-foot", "base16-helix": "base16-helix", - "base16-kitty": "base16-kitty", - "base16-tmux": "base16-tmux", "base16-vim": "base16-vim", "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_3", "gnome-shell": "gnome-shell", "home-manager": "home-manager_3", - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_4", + "systems": "systems_2", + "tinted-foot": "tinted-foot", + "tinted-kitty": "tinted-kitty", + "tinted-tmux": "tinted-tmux" }, "locked": { - "lastModified": 1719525570, - "narHash": "sha256-xSO/H67GAHEW0siD2PHoO/e97MbROL3r3s5SpF6A6Dc=", + "lastModified": 1728900372, + "narHash": "sha256-hmG/u7qZEm7CTh1XPDi+pg4Oi0nNrv7sL8PgZDRe6wg=", "owner": "danth", "repo": "stylix", - "rev": "1ff9d37d27377bfe8994c24a8d6c6c1734ffa116", + "rev": "33a2eff15181e557bb6dd9d2073b90f7d218975d", "type": "github" }, "original": { @@ -1004,6 +960,55 @@ "type": "github" } }, + "tinted-foot": { + "flake": false, + "locked": { + "lastModified": 1696725948, + "narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=", + "owner": "tinted-theming", + "repo": "tinted-foot", + "rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "tinted-foot", + "type": "github" + } + }, + "tinted-kitty": { + "flake": false, + "locked": { + "lastModified": 1716423189, + "narHash": "sha256-2xF3sH7UIwegn+2gKzMpFi3pk5DlIlM18+vj17Uf82U=", + "owner": "tinted-theming", + "repo": "tinted-kitty", + "rev": "eb39e141db14baef052893285df9f266df041ff8", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "tinted-kitty", + "rev": "eb39e141db14baef052893285df9f266df041ff8", + "type": "github" + } + }, + "tinted-tmux": { + "flake": false, + "locked": { + "lastModified": 1696725902, + "narHash": "sha256-wDPg5elZPcQpu7Df0lI5O8Jv4A3T6jUQIVg63KDU+3Q=", + "owner": "tinted-theming", + "repo": "tinted-tmux", + "rev": "c02050bebb60dbb20cb433cd4d8ce668ecc11ba7", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "tinted-tmux", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ @@ -1047,7 +1052,7 @@ }, "wezterm": { "inputs": { - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_4", "freetype2": "freetype2", "harfbuzz": "harfbuzz", "libpng": "libpng", @@ -1057,11 +1062,11 @@ }, "locked": { "dir": "nix", - "lastModified": 1723525023, - "narHash": "sha256-ZsDJQSUokodwFMP4FIZm2dYojf5iC4F/EeKC5VuQlqY=", + "lastModified": 1729006311, + "narHash": "sha256-1xtKJHu6CFnOhp4snof+WSTwcdPgwIaD6mBODP/cv3w=", "owner": "wez", "repo": "wezterm", - "rev": "30345b36d8a00fed347e4df5dadd83915a7693fb", + "rev": "9ddca7bde92090792dbcdc65c1e9897c362196d7", "type": "github" }, "original": { @@ -1078,11 +1083,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1718525212, - "narHash": "sha256-6IuZ2lf9KhvFUFBRKrpgzT9J70lqKZ8f5pdkITXzKZE=", + "lastModified": 1727849733, + "narHash": "sha256-mqxs/nyzOEKiBHa94OtcOLYBXd65P8tO4DUVTHWHn6o=", "owner": "Toqozz", "repo": "wired-notify", - "rev": "9e4bbd5873b11de6547cf787618a708fad076557", + "rev": "a1f6965737754e7424f9468f6befef885a9ee0ad", "type": "github" }, "original": { diff --git a/host/features/networking.nix b/host/features/networking.nix index 4aa8915..ba5f116 100644 --- a/host/features/networking.nix +++ b/host/features/networking.nix @@ -23,12 +23,12 @@ wireless = { enable = true; userControlled.enable = true; - environmentFile = config.sops.secrets.networks.path; + secretsFile = config.sops.secrets.networks.path; networks = { - "Meshki56".psk = "@PSK_Meshki56@"; - "308a_niezaliczan_semestranu".psk = "@PSK_308a_niezaliczan_semestranu@"; + "Meshki56".pskRaw = "ext:PSK_Meshki56"; + "308a_niezaliczan_semestranu".pskRaw = "ext:PSK_308a_niezaliczan_semestranu"; "hot_pot" = { - psk = "@PSK_hot_pot@"; + pskRaw = "ext:PSK_hot_pot"; priority = -10; }; }; From 8246e073eeae28d5d50f96b3eb081b4bab2caffb Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Sun, 20 Oct 2024 13:09:14 +0200 Subject: [PATCH 05/21] fix: broken by update --- .envrc | 2 +- flake.lock | 18 +++++++++++++- flake.nix | 38 +++++++++++++++++++----------- home/features/global/wezterm.nix | 17 +++++++++++++ home/features/hyprland/default.nix | 15 ++++++++---- home/features/walker/default.nix | 7 +++--- host/features/virtualbox.nix | 2 +- shell.nix | 9 +++---- 8 files changed, 80 insertions(+), 28 deletions(-) diff --git a/.envrc b/.envrc index 1d953f4..3550a30 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use nix +use flake diff --git a/flake.lock b/flake.lock index e6d1208..8796f15 100755 --- a/flake.lock +++ b/flake.lock @@ -296,7 +296,7 @@ }, "flake-utils_4": { "inputs": { - "systems": "systems_3" + "systems": "systems_4" }, "locked": { "lastModified": 1710146030, @@ -822,6 +822,7 @@ "nixpkgs": "nixpkgs_2", "sops-nix": "sops-nix", "stylix": "stylix", + "systems": "systems_3", "walker": "walker", "wezterm": "wezterm", "wired": "wired" @@ -946,6 +947,20 @@ } }, "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "id": "systems", + "type": "indirect" + } + }, + "systems_4": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -1072,6 +1087,7 @@ "original": { "dir": "nix", "owner": "wez", + "ref": "main", "repo": "wezterm", "type": "github" } diff --git a/flake.nix b/flake.nix index c6be72b..1839ff5 100755 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,7 @@ stylix.url = "github:danth/stylix"; - wezterm.url = "github:wez/wezterm?dir=nix"; + wezterm.url = "github:wez/wezterm/main?dir=nix"; neovim.url = "github:NikodemMarek/neovim"; @@ -42,27 +42,37 @@ outputs = { self, nixpkgs, + home-manager, + systems, ... } @ inputs: let inherit (self) outputs; - forAllSystems = nixpkgs.lib.genAttrs [ - "x86_64-linux" - ]; + lib = nixpkgs.lib // home-manager.lib; + + forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system}); + pkgsFor = lib.genAttrs (import systems) ( + system: + import nixpkgs { + inherit system; + config = { + allowUnfree = true; + allowUnfreePredicate = _: true; + }; + } + ); in { + inherit lib; + nixosModules = import ./modules/host; homeManagerModules = import ./modules/home; - packages = forAllSystems ( - system: let - pkgs = nixpkgs.legacyPackages.${system}; - in - import ./pkgs {inherit pkgs;} - ); overlays = import ./overlays {inherit inputs;}; + packages = forEachSystem (pkgs: import ./pkgs {inherit pkgs;}); + devShells = forEachSystem (pkgs: import ./shell.nix {inherit pkgs;}); nixosConfigurations = let - mkhost = host: + mkHost = host: nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs outputs;}; modules = [ @@ -71,9 +81,9 @@ ]; }; in { - laptop = mkhost "laptop"; - desktop = mkhost "desktop"; - LP-043 = mkhost "LP-043"; + laptop = mkHost "laptop"; + desktop = mkHost "desktop"; + LP-043 = mkHost "LP-043"; }; }; } diff --git a/home/features/global/wezterm.nix b/home/features/global/wezterm.nix index f676cd8..d2b639e 100644 --- a/home/features/global/wezterm.nix +++ b/home/features/global/wezterm.nix @@ -19,7 +19,24 @@ enable_wayland = false, window_close_confirmation = "NeverPrompt", + unix_domains = { + { + name = 'unix', + }, + }, + default_gui_startup_args = { 'connect', 'unix' }, + ssh_domains = { + { + name = 'desktop.nikodem', + remote_address = 'desktop.nikodem', + username = 'nikodem', + }, + { + name = 'laptop.nikodem', + remote_address = 'laptop.nikodem', + username = 'nikodem', + }, { name = 'LP-043.nm1', remote_address = 'LP-043.nm1', diff --git a/home/features/hyprland/default.nix b/home/features/hyprland/default.nix index 9b0b5fe..03f1cde 100755 --- a/home/features/hyprland/default.nix +++ b/home/features/hyprland/default.nix @@ -1,4 +1,9 @@ -{pkgs, ...}: { +{ + lib, + pkgs, + config, + ... +}: { imports = [ ./hyprlock.nix @@ -87,7 +92,9 @@ "$mod" = "SUPER"; - bind = + bind = let + wezterm = lib.getExe config.programs.wezterm.package; + in [ # Toggle window states "$mod, V, togglefloating," @@ -128,8 +135,8 @@ # Execs "$mod, SPACE, exec, walker" - "$mod, RETURN, exec, ${pkgs.wezterm}/bin/wezterm-gui start --always-new-process" - "$mod, E, exec, ${pkgs.wezterm}/bin/wezterm start --always-new-process ${pkgs.yazi}/bin/yazi" + "$mod, RETURN, exec, ${wezterm} start --always-new-process" + "$mod, E, exec, ${wezterm} start --always-new-process ${pkgs.yazi}/bin/yazi" ", PRINT, exec, grim -g \"$(slurp)\" - | wl-copy" # screenshot "SHIFT, PRINT, exec, grim -g \"$(slurp)\" ~/screenshots/$(date +'%Y-%m-%d_%H:%M:%S').png" # screenshot diff --git a/home/features/walker/default.nix b/home/features/walker/default.nix index f97ada1..c17c0a4 100644 --- a/home/features/walker/default.nix +++ b/home/features/walker/default.nix @@ -1,6 +1,7 @@ { inputs, - pkgs, + lib, + config, ... }: { imports = [ @@ -13,8 +14,8 @@ enable = true; runAsService = true; config = { - theme = "catppuccin"; - terminal = "${pkgs.wezterm}/bin/wezterm start"; + theme = "catppuccin"; + terminal = "${lib.getExe config.programs.wezterm.package} start"; show_initial_entries = true; list = { height = 500; diff --git a/host/features/virtualbox.nix b/host/features/virtualbox.nix index 63690ec..c858af8 100644 --- a/host/features/virtualbox.nix +++ b/host/features/virtualbox.nix @@ -7,7 +7,7 @@ }; guest = { enable = true; - draganddrop = true; + dragAndDrop = true; clipboard = true; }; }; diff --git a/shell.nix b/shell.nix index f05b526..82d80ab 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,4 @@ -{pkgs ? import {}}: let +{pkgs ? import {}, ...}: let aliases = [ { name = "host-switch"; @@ -80,8 +80,8 @@ description = "[host user@ip] install on remote host"; } ]; -in - pkgs.mkShell { +in { + default = pkgs.mkShell { buildInputs = [pkgs.nh pkgs.ssh-to-age pkgs.sops pkgs.nixos-anywhere pkgs.disko] ++ (map (alias: pkgs.writeShellScriptBin alias.name alias.command) aliases); @@ -90,4 +90,5 @@ in ${builtins.concatStringsSep "\n" (map (alias: "\\e[1m${alias.name}\\e[0m\\e[33m \t\t -> ${alias.description}") aliases)} \e[0m" ''; - } + }; +} From 985edcb176ade74a3eef2cc884b51c16058db12d Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Mon, 28 Oct 2024 13:34:34 +0100 Subject: [PATCH 06/21] feat(laptop): removed music, ollama and zerotier --- host/features/default.nix | 2 ++ host/laptop/default.nix | 10 ---------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/host/features/default.nix b/host/features/default.nix index 6dc17e4..9c1995c 100755 --- a/host/features/default.nix +++ b/host/features/default.nix @@ -45,5 +45,7 @@ security.protectKernelImage = false; + users.mutableUsers = false; + system.stateVersion = "24.05"; } diff --git a/host/laptop/default.nix b/host/laptop/default.nix index c51943a..645efd9 100755 --- a/host/laptop/default.nix +++ b/host/laptop/default.nix @@ -16,8 +16,6 @@ ../features/hyprland.nix ../features/docker.nix ../features/dnscrypt-proxy2.nix - ../features/zerotier.nix - ../features/ollama.nix ../features/battery-saver.nix ../features/bluetooth.nix @@ -44,12 +42,4 @@ shell = pkgs.fish; }; }; - - services = { - music = { - enable = true; - anysync = true; - persistent = true; - }; - }; } From 7c68090ee7fb3de72856fab39747c1b4021ec778 Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Mon, 28 Oct 2024 13:35:07 +0100 Subject: [PATCH 07/21] fix(battery-notifier): starts automatically --- modules/home/battery-notifier.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/home/battery-notifier.nix b/modules/home/battery-notifier.nix index 5b2e265..9cbea5c 100644 --- a/modules/home/battery-notifier.nix +++ b/modules/home/battery-notifier.nix @@ -40,7 +40,7 @@ in { OnCalendar = "*:0/${toString cfg.checkInterval}"; }; Install = { - WantedBy = ["graphical.target"]; + WantedBy = ["default.target"]; }; }; From c3317f479ed83505e676defe848de748111f43dc Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Fri, 1 Nov 2024 11:45:51 +0100 Subject: [PATCH 08/21] fix(ssh): key not set correctly --- home/features/global/sops.nix | 3 ++- home/features/ssh.nix | 7 +++---- host/features/home-manager.nix | 6 +----- host/laptop/secrets.yaml | 8 +++----- modules/home/settings.nix | 4 ---- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/home/features/global/sops.nix b/home/features/global/sops.nix index 6f40a0d..de2ae20 100644 --- a/home/features/global/sops.nix +++ b/home/features/global/sops.nix @@ -1,5 +1,6 @@ { inputs, + host-config, config, ... }: let @@ -21,7 +22,7 @@ in { sops = { age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt"; - defaultSopsFile = ../../../host/${config.settings.hostname}/secrets.yaml; + defaultSopsFile = ../../../host/${host-config.networking.hostName}/secrets.yaml; }; home = { diff --git a/home/features/ssh.nix b/home/features/ssh.nix index 16d04d0..d3b539c 100644 --- a/home/features/ssh.nix +++ b/home/features/ssh.nix @@ -1,14 +1,13 @@ { lib, + host-config, config, ... }: { home = { file = { - ".ssh/id_ed25519.pub".source = ../../host/${config.settings.hostname}/user_${config.home.username}_ssh_id_ed25519.pub; - ".ssh/id_ed25519" = lib.mkIf (builtins.pathExists config.sops.secrets."users/${config.home.username}/ssh_id_ed25519".path) { - source = config.sops.secrets."users/${config.home.username}/ssh_id_ed25519".path; - }; + ".ssh/id_ed25519.pub".source = ../../host/${host-config.networking.hostName}/user_${config.home.username}_ssh_id_ed25519.pub; + ".ssh/id_ed25519".source = config.sops.secrets."users/${config.home.username}/ssh_id_ed25519".path; }; persistence."/persist/${config.home.homeDirectory}".directories = [ ".ssh" diff --git a/host/features/home-manager.nix b/host/features/home-manager.nix index 8089531..b621c6c 100644 --- a/host/features/home-manager.nix +++ b/host/features/home-manager.nix @@ -28,11 +28,7 @@ home.username = user.name; - settings = - { - hostname = config.networking.hostName; - } - // config.settings; + settings = config.settings; }; }) (builtins.filter (user: (builtins.pathExists diff --git a/host/laptop/secrets.yaml b/host/laptop/secrets.yaml index 6debb89..4c15b64 100644 --- a/host/laptop/secrets.yaml +++ b/host/laptop/secrets.yaml @@ -4,8 +4,6 @@ users: ssh_id_ed25519: ENC[AES256_GCM,data:teeImSj904eiUOw6jQrWEdmONQRfnHIiKuHXTQYeS8RRd47EauRNnoJY0TnqYEl5iizvXZo83LL4SCKRzGPdvWTTyCUGSPqwoBR/tOP/H5jEyBsY4z5HNlPlFu8EKfLgMKxYjIY+Hhi01JHb0OWmDACIMOvKxbHHf5VmLCJaa20y2+3V7G0X8UyCi8gFmFxcslNH66YdQpySTmDcK42qSoZvQ87zJ1WKvJuiECPPyQxZ5AAKgd6FHFnb9+rdBmLlNxZRuQhAMJAJQdbyBSoee6rqH1j9Zc1ps4P+17hECSfmdZdgCFRmD5c6jJb7cCXh2P5fv0nCKJE20ywUFBq47wTlqcgtzwJ4+DNnKIHludrxB17ySanvi7oqJGk88vBff7ZmXKYM9iNmCujk+JDIzYMRM8hPkiijtKr60enHrNWg1EBYIR0FhnBdXrorcsH0eZ5j5nA5H91dcVIk3gSJKJLA96opbDKMjKYHE4stLBnxLzpp3cryy+kcf0rJuYo+zZx8J3/ytD1vrwT5Z6aaLGeoqUKmKCnVyhJr,iv:ZMOTYZYQLf/bNFDpMkBpQYP8tTwIZHE+2vuBZGi5GHc=,tag:F/Ck9vVM1jvvtdBPCb9dyA==,type:str] fun: password: ENC[AES256_GCM,data:KL93H3xH1e1asCTOCScKns3IOQevSLJcU3ik02lxssVPmO+gUMA9g2gD7ajLZEUp+5mQWI/CHRxW28HMHl8qrETLKrOu4IBGVw==,iv:+b0NhFcXVLoWQnAxrS38St16ciineMGgVF6PZFKQSXM=,tag:qL6xPKb0pLG/FxCR5pOO8g==,type:str] - music: - password: ENC[AES256_GCM,data:177jcV9QuyFJAeykcHk+J8iMWOEITGiNlolEcQzEM0/hFPQZ4Pjx6ELwEc2EVziWm3/ZWrLeWKVXgU7HBCUNQDxLSMTrgdbvCg==,iv:b6ENkVz57DqNYxccBZA+1hMcwpgXyLtNEr6URCes/wY=,tag:P+KXN2Z4bDz9pP2qGAWHxQ==,type:str] host_ssh_ed25519_priv: ENC[AES256_GCM,data:/wVS9lClgQt9AXrYn/XQxgXZqCzdC7R5B9nwMhf+8rOxfud+lFkCCVZ6yH3cVnq8Bw1EZ7vjfWMkYaaozGz5twl5I45XhxjKRDBMFlBMYWum+LOMje68P6zyN9P/mxZV8SyK3cxRjub176e1i1kBzFBCO4wzJE1/M8x189Zn/FCrvfqozvSeqmUI9teVwXYH37RykX5ZjhE6zs3Aj0H0Ya2jd6EiHw9y/AsO5ECjxWQogzf18rZOXuX3VcPcgQUt4dT0WubZy5Chxu01iNRZFIe/DBSnq/mUuPBjFz0h4GNo1lmT+KB1xt736pbEZlIGzDWLOjMHbEWiAQ7XAfwG2VCdzOf9HJKCC494+NbJlK7Hr+MazgRLpZQtZFCtyTgTN5Hd7zpF1kOsi2dbfKQG5t9WBNbga4vM/SwaNZ1u4c3854r1m/VOtiXUz3I4aDUHiKNeSIb8pOGeRn9Hkw3RegVg1g70doCMcKWV8/QtR8p3uRZDKn2AvAYbPYZVUCX+fCQdb+Axlay14EJhtsqi,iv:l6b4aSFDEysICYoZLqQQJXtTMK7eSRw7g3JWBlZ2KFU=,tag:gDTU/LDQyar11c+nExRHkA==,type:str] sops: kms: [] @@ -40,8 +38,8 @@ sops: RmZGMDZCdnd3eG80WDhDVXBrMFBEaGMKmbzJXSl/Mczg2bQ5K7yymYPK/NZOc39t Lj+1oBjj9F7k1ItlpkaPxNJBnL+caokKeC88fkFr93xfAWWxsHfBfA== -----END AGE ENCRYPTED FILE----- - lastmodified: "2024-09-14T12:12:36Z" - mac: ENC[AES256_GCM,data:wvySKGyCmZUFHvfQjYNUmxQSGQLIKUtLpsC0bMvIt6YIMUowDaTL8S6StltJg0A/U2P8M9NZqLwqJedVl7M0wJwuqN6+HbBp311ejoSSb1R0heMD+vEsBanDiOEE11XHmuLmNHRFsQhtqzl5tVYACNRYZyHGMhOiWJ8o+BUvtEc=,iv:jXUN5oYToCuLJV6djE4ZDvKPZGYwIM3TScCfkozgTfY=,tag:DDcKDSD/UQ+I1xnwOboH/g==,type:str] + lastmodified: "2024-10-28T13:14:17Z" + mac: ENC[AES256_GCM,data:Yiwt96IEhqZws5dP+LtOAA8vxn8pPBo8LqwODbKRvw48R/DZ3L6jdBshMaZdSQZDklIahSMWDcakFVKoM9qXixucp/kB2Q6JAhNB5n2+1TkcycQ/cCRkZnxAj2aFAGXwMmFSsXscYEaCAf1Oc7Pb2TnVESJwHgw7MD8bq450UBs=,iv:mJ+yuDIpJz3hrc6OwLp4QRaO+ckAtR6HQ/dnlCmjDtI=,tag:wcX2CeniOtY/7YTBb7wHIg==,type:str] pgp: [] unencrypted_suffix: _unencrypted - version: 3.8.1 + version: 3.9.1 diff --git a/modules/home/settings.nix b/modules/home/settings.nix index db5a849..074e832 100644 --- a/modules/home/settings.nix +++ b/modules/home/settings.nix @@ -4,9 +4,5 @@ type = lib.types.str; default = "/dotfiles"; }; - - hostname = lib.mkOption { - type = lib.types.str; - }; }; } From 6ce3735a5979d95578ea6a4131c381a78adbd84f Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Sat, 2 Nov 2024 14:22:32 +0100 Subject: [PATCH 09/21] feat(impermanence): rollback script handled by systemd --- .../disko/btrfs-persistence-swapfile.nix | 1 - host/features/impermanence.nix | 61 ++++++++++++------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/host/features/disko/btrfs-persistence-swapfile.nix b/host/features/disko/btrfs-persistence-swapfile.nix index 1ee30e7..b5f9ae1 100644 --- a/host/features/disko/btrfs-persistence-swapfile.nix +++ b/host/features/disko/btrfs-persistence-swapfile.nix @@ -53,7 +53,6 @@ }; mountpoint = "/"; - swap.swapfile.size = "${builtins.toString swap}G"; }; }; }; diff --git a/host/features/impermanence.nix b/host/features/impermanence.nix index 8a4758f..f5997b7 100644 --- a/host/features/impermanence.nix +++ b/host/features/impermanence.nix @@ -8,30 +8,49 @@ inputs.impermanence.nixosModules.impermanence ]; - boot.initrd.postDeviceCommands = lib.mkAfter '' - mkdir /btrfs_tmp - mount /dev/root /btrfs_tmp - if [[ -e /btrfs_tmp/root ]]; then - mkdir -p /btrfs_tmp/old_roots - timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S") - mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp" - fi + boot.initrd = { + supportedFilesystems = ["btrfs"]; + systemd = { + enable = true; + services.rollback = { + description = "Rollback BTRFS root subvolume to a pristine state"; + wantedBy = [ + "initrd.target" + ]; + before = [ + "sysroot.mount" + ]; + requires = ["dev-nvme0n1p2.device"]; + after = ["dev-nvme0n1p2.device"]; + unitConfig.DefaultDependencies = "no"; + serviceConfig.Type = "oneshot"; + script = '' + mkdir /btrfs_tmp + mount /dev/disk/by-partlabel/disk-main-root /btrfs_tmp + if [[ -e /btrfs_tmp/root ]]; then + mkdir -p /btrfs_tmp/old_roots + timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S") + mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp" + fi - delete_subvolume_recursively() { - IFS=$'\n' - for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do - delete_subvolume_recursively "/btrfs_tmp/$i" - done - btrfs subvolume delete "$1" - } + delete_subvolume_recursively() { + IFS=$'\n' + for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do + delete_subvolume_recursively "/btrfs_tmp/$i" + done + btrfs subvolume delete "$1" + } - for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do - delete_subvolume_recursively "$i" - done + for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do + delete_subvolume_recursively "$i" + done - btrfs subvolume create /btrfs_tmp/root - umount /btrfs_tmp - ''; + btrfs subvolume create /btrfs_tmp/root + umount /btrfs_tmp + ''; + }; + }; + }; fileSystems."/persist".neededForBoot = true; programs.fuse.userAllowOther = true; From 755031cdf44390abf971b33147dc7a6a664ae5dc Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Sat, 2 Nov 2024 17:32:26 +0100 Subject: [PATCH 10/21] fix(fun): persist steam --- home/fun/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/home/fun/default.nix b/home/fun/default.nix index 96ecdf3..b9f707f 100644 --- a/home/fun/default.nix +++ b/home/fun/default.nix @@ -40,6 +40,8 @@ "games" ".local/share/PrismLauncher" + + ".local/share/Steam" ]; }; } From fcad7b06dd327aa9cb694f00b2a083abbadf0d58 Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Sun, 3 Nov 2024 00:39:38 +0100 Subject: [PATCH 11/21] feat(persistence): split persisted files into categories --- .envrc | 0 .gitignore | 0 .sops.yaml | 0 assets/background.png | Bin assets/catppuccin-mocha.nix | 0 home/ctf/default.nix | 3 - home/features/beets.nix | 0 home/features/bun.nix | 0 home/features/default.nix | 0 home/features/docker.nix | 2 +- home/features/fabric-ai.nix | 2 +- home/features/global/default.nix | 0 home/features/global/direnv.nix | 2 +- home/features/global/eza.nix | 0 home/features/global/firefox.nix | 2 +- home/features/global/gh.nix | 8 ++- home/features/global/git.nix | 0 home/features/global/gitui.nix | 0 home/features/global/nh.nix | 0 home/features/global/qutebrowser.nix | 0 home/features/global/shell.nix | 2 +- home/features/global/sops.nix | 2 +- home/features/global/tools.nix | 0 home/features/global/wezterm.nix | 0 home/features/global/wired-notify.nix | 0 home/features/global/zellij.nix | 0 home/features/hyprland/hyprlock.nix | 0 home/features/impermanence.nix | 30 ++++++---- home/features/neovim.nix | 2 +- home/features/obsidian.nix | 12 ++-- home/features/ollama.nix | 0 home/features/ssh.nix | 3 +- home/features/walker/default.nix | 0 home/features/walker/powermodule.nix | 0 home/features/yazi.nix | 0 home/features/yt-dlp.nix | 0 home/fun/default.nix | 15 +++-- home/nikodem/default.nix | 2 +- home/nm1/default.nix | 2 +- home/nm1/kanshi.nix | 0 host/LP-043/m2_settings.xml | 0 host/LP-043/networks.env | 0 host/LP-043/openfortivpn_cert.pem | 0 host/LP-043/openfortivpn_key.pem | 0 host/LP-043/secrets.nix | 0 host/LP-043/secrets.yaml | 0 host/LP-043/ssh_host_ed25519_key.pub | 0 host/LP-043/user_nm1_ssh_id_ed25519.pub | 0 host/desktop/hardware-configuration.nix | 0 host/desktop/kanshi.nix | 0 host/desktop/nextcloud.nix | 0 host/desktop/secrets.nix | 0 host/desktop/secrets.yaml | 0 host/desktop/ssh_host_ed25519_key.pub | 0 host/desktop/syncthing_cert.pem | 0 host/desktop/syncthing_key.pem | 0 host/desktop/user_nikodem_ssh_id_ed25519.pub | 0 host/features/battery-saver.nix | 0 host/features/bluetooth.nix | 0 .../disko/btrfs-persistence-swapfile.nix | 0 .../features/disko/btrfs-single-partition.nix | 0 host/features/disko/default.nix | 0 .../disko/device-btrfs-persistence.nix | 0 host/features/dnscrypt-proxy2.nix | 0 host/features/docker.nix | 2 +- host/features/graphics.nix | 0 host/features/greetd.nix | 0 host/features/home-manager.nix | 0 host/features/hyprland.nix | 0 host/features/impermanence.nix | 55 +++++++++++------- host/features/networking.nix | 0 host/features/ollama.nix | 2 +- host/features/openfortivpn.nix | 0 host/features/openssh.nix | 2 +- host/features/pipewire.nix | 0 host/features/sops.nix | 2 +- host/features/stylix.nix | 0 host/features/sudo.nix | 0 host/features/syncthing.nix | 0 host/features/time.nix | 0 host/features/tools.nix | 0 host/features/virtualbox.nix | 0 host/features/zerotier.nix | 0 host/laptop/hardware-configuration.nix | 2 - host/laptop/kanshi.nix | 0 host/laptop/secrets.nix | 0 host/laptop/secrets.yaml | 0 host/laptop/ssh_host_ed25519_key.pub | 0 host/laptop/user_nikodem_ssh_id_ed25519.pub | 0 modules/home/battery-notifier.nix | 0 modules/home/default.nix | 0 modules/home/openfortivpn.nix | 0 modules/home/settings.nix | 0 modules/host/default.nix | 0 modules/host/music.nix | 0 modules/host/settings.nix | 0 pkgs/anysync.nix | 0 pkgs/fabric-ai.nix | 0 secrets/api-keys.nix | 0 secrets/api-keys.yaml | 0 secrets/networks.env | 0 secrets/networks.nix | 0 shell.nix | 6 +- 103 files changed, 91 insertions(+), 69 deletions(-) mode change 100644 => 100755 .envrc mode change 100644 => 100755 .gitignore mode change 100644 => 100755 .sops.yaml mode change 100644 => 100755 assets/background.png mode change 100644 => 100755 assets/catppuccin-mocha.nix mode change 100644 => 100755 home/ctf/default.nix mode change 100644 => 100755 home/features/beets.nix mode change 100644 => 100755 home/features/bun.nix mode change 100644 => 100755 home/features/default.nix mode change 100644 => 100755 home/features/docker.nix mode change 100644 => 100755 home/features/fabric-ai.nix mode change 100644 => 100755 home/features/global/default.nix mode change 100644 => 100755 home/features/global/direnv.nix mode change 100644 => 100755 home/features/global/eza.nix mode change 100644 => 100755 home/features/global/firefox.nix mode change 100644 => 100755 home/features/global/gh.nix mode change 100644 => 100755 home/features/global/git.nix mode change 100644 => 100755 home/features/global/gitui.nix mode change 100644 => 100755 home/features/global/nh.nix mode change 100644 => 100755 home/features/global/qutebrowser.nix mode change 100644 => 100755 home/features/global/shell.nix mode change 100644 => 100755 home/features/global/sops.nix mode change 100644 => 100755 home/features/global/tools.nix mode change 100644 => 100755 home/features/global/wezterm.nix mode change 100644 => 100755 home/features/global/wired-notify.nix mode change 100644 => 100755 home/features/global/zellij.nix mode change 100644 => 100755 home/features/hyprland/hyprlock.nix mode change 100644 => 100755 home/features/impermanence.nix mode change 100644 => 100755 home/features/neovim.nix mode change 100644 => 100755 home/features/obsidian.nix mode change 100644 => 100755 home/features/ollama.nix mode change 100644 => 100755 home/features/ssh.nix mode change 100644 => 100755 home/features/walker/default.nix mode change 100644 => 100755 home/features/walker/powermodule.nix mode change 100644 => 100755 home/features/yazi.nix mode change 100644 => 100755 home/features/yt-dlp.nix mode change 100644 => 100755 home/fun/default.nix mode change 100644 => 100755 home/nikodem/default.nix mode change 100644 => 100755 home/nm1/default.nix mode change 100644 => 100755 home/nm1/kanshi.nix mode change 100644 => 100755 host/LP-043/m2_settings.xml mode change 100644 => 100755 host/LP-043/networks.env mode change 100644 => 100755 host/LP-043/openfortivpn_cert.pem mode change 100644 => 100755 host/LP-043/openfortivpn_key.pem mode change 100644 => 100755 host/LP-043/secrets.nix mode change 100644 => 100755 host/LP-043/secrets.yaml mode change 100644 => 100755 host/LP-043/ssh_host_ed25519_key.pub mode change 100644 => 100755 host/LP-043/user_nm1_ssh_id_ed25519.pub mode change 100644 => 100755 host/desktop/hardware-configuration.nix mode change 100644 => 100755 host/desktop/kanshi.nix mode change 100644 => 100755 host/desktop/nextcloud.nix mode change 100644 => 100755 host/desktop/secrets.nix mode change 100644 => 100755 host/desktop/secrets.yaml mode change 100644 => 100755 host/desktop/ssh_host_ed25519_key.pub mode change 100644 => 100755 host/desktop/syncthing_cert.pem mode change 100644 => 100755 host/desktop/syncthing_key.pem mode change 100644 => 100755 host/desktop/user_nikodem_ssh_id_ed25519.pub mode change 100644 => 100755 host/features/battery-saver.nix mode change 100644 => 100755 host/features/bluetooth.nix mode change 100644 => 100755 host/features/disko/btrfs-persistence-swapfile.nix mode change 100644 => 100755 host/features/disko/btrfs-single-partition.nix mode change 100644 => 100755 host/features/disko/default.nix mode change 100644 => 100755 host/features/disko/device-btrfs-persistence.nix mode change 100644 => 100755 host/features/dnscrypt-proxy2.nix mode change 100644 => 100755 host/features/docker.nix mode change 100644 => 100755 host/features/graphics.nix mode change 100644 => 100755 host/features/greetd.nix mode change 100644 => 100755 host/features/home-manager.nix mode change 100644 => 100755 host/features/hyprland.nix mode change 100644 => 100755 host/features/impermanence.nix mode change 100644 => 100755 host/features/networking.nix mode change 100644 => 100755 host/features/ollama.nix mode change 100644 => 100755 host/features/openfortivpn.nix mode change 100644 => 100755 host/features/openssh.nix mode change 100644 => 100755 host/features/pipewire.nix mode change 100644 => 100755 host/features/sops.nix mode change 100644 => 100755 host/features/stylix.nix mode change 100644 => 100755 host/features/sudo.nix mode change 100644 => 100755 host/features/syncthing.nix mode change 100644 => 100755 host/features/time.nix mode change 100644 => 100755 host/features/tools.nix mode change 100644 => 100755 host/features/virtualbox.nix mode change 100644 => 100755 host/features/zerotier.nix mode change 100644 => 100755 host/laptop/kanshi.nix mode change 100644 => 100755 host/laptop/secrets.nix mode change 100644 => 100755 host/laptop/secrets.yaml mode change 100644 => 100755 host/laptop/ssh_host_ed25519_key.pub mode change 100644 => 100755 host/laptop/user_nikodem_ssh_id_ed25519.pub mode change 100644 => 100755 modules/home/battery-notifier.nix mode change 100644 => 100755 modules/home/default.nix mode change 100644 => 100755 modules/home/openfortivpn.nix mode change 100644 => 100755 modules/home/settings.nix mode change 100644 => 100755 modules/host/default.nix mode change 100644 => 100755 modules/host/music.nix mode change 100644 => 100755 modules/host/settings.nix mode change 100644 => 100755 pkgs/anysync.nix mode change 100644 => 100755 pkgs/fabric-ai.nix mode change 100644 => 100755 secrets/api-keys.nix mode change 100644 => 100755 secrets/api-keys.yaml mode change 100644 => 100755 secrets/networks.env mode change 100644 => 100755 secrets/networks.nix mode change 100644 => 100755 shell.nix diff --git a/.envrc b/.envrc old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.sops.yaml b/.sops.yaml old mode 100644 new mode 100755 diff --git a/assets/background.png b/assets/background.png old mode 100644 new mode 100755 diff --git a/assets/catppuccin-mocha.nix b/assets/catppuccin-mocha.nix old mode 100644 new mode 100755 diff --git a/home/ctf/default.nix b/home/ctf/default.nix old mode 100644 new mode 100755 index be896aa..9d5bda7 --- a/home/ctf/default.nix +++ b/home/ctf/default.nix @@ -1,7 +1,6 @@ { pkgs, host-config, - config, ... }: { imports = [ @@ -33,7 +32,5 @@ xh openssl ]; - persistence."/persist/${config.home.homeDirectory}".directories = [ - ]; }; } diff --git a/home/features/beets.nix b/home/features/beets.nix old mode 100644 new mode 100755 diff --git a/home/features/bun.nix b/home/features/bun.nix old mode 100644 new mode 100755 diff --git a/home/features/default.nix b/home/features/default.nix old mode 100644 new mode 100755 diff --git a/home/features/docker.nix b/home/features/docker.nix old mode 100644 new mode 100755 index e8fdf01..35e5f42 --- a/home/features/docker.nix +++ b/home/features/docker.nix @@ -3,7 +3,7 @@ shellAliases = { d = "docker"; }; - persistence."/persist/${config.home.homeDirectory}".directories = [ + persistence."/persist/generated/${config.home.homeDirectory}".directories = [ ".docker" ".dockercache" ]; diff --git a/home/features/fabric-ai.nix b/home/features/fabric-ai.nix old mode 100644 new mode 100755 index 45e7297..b653657 --- a/home/features/fabric-ai.nix +++ b/home/features/fabric-ai.nix @@ -25,7 +25,7 @@ in { packages = with pkgs; [ fabric-ai ]; - persistence."/persist/${config.home.homeDirectory}".directories = [ + persistence."/persist/generated/${config.home.homeDirectory}".directories = [ ".config/fabric" ]; }; diff --git a/home/features/global/default.nix b/home/features/global/default.nix old mode 100644 new mode 100755 diff --git a/home/features/global/direnv.nix b/home/features/global/direnv.nix old mode 100644 new mode 100755 index 87a15eb..fced433 --- a/home/features/global/direnv.nix +++ b/home/features/global/direnv.nix @@ -13,7 +13,7 @@ shellAliases = { direnvenable = "echo use nix > .envrc; direnv allow"; }; - persistence."/persist/${config.home.homeDirectory}".directories = [ + persistence."/persist/generated/${config.home.homeDirectory}".directories = [ ".local/share/direnv" ]; }; diff --git a/home/features/global/eza.nix b/home/features/global/eza.nix old mode 100644 new mode 100755 diff --git a/home/features/global/firefox.nix b/home/features/global/firefox.nix old mode 100644 new mode 100755 index 30f1741..7dd2886 --- a/home/features/global/firefox.nix +++ b/home/features/global/firefox.nix @@ -22,7 +22,7 @@ }; }; - home.persistence."/persist/${config.home.homeDirectory}".directories = [ + home.persistence."/persist/generated/${config.home.homeDirectory}".directories = [ ".mozilla" ]; } diff --git a/home/features/global/gh.nix b/home/features/global/gh.nix old mode 100644 new mode 100755 index 33dad84..fe7ec5e --- a/home/features/global/gh.nix +++ b/home/features/global/gh.nix @@ -1,4 +1,8 @@ -{pkgs, config, ...}: { +{ + pkgs, + config, + ... +}: { programs.gh = { enable = true; settings = { @@ -13,7 +17,7 @@ shellAliases = { ghsg = "gh copilot suggest --target shell '$_'"; }; - persistence."/persist/${config.home.homeDirectory}".directories = [ + persistence."/persist/generated/${config.home.homeDirectory}".directories = [ ".config/github-copilot" ".local/share/gh" ]; diff --git a/home/features/global/git.nix b/home/features/global/git.nix old mode 100644 new mode 100755 diff --git a/home/features/global/gitui.nix b/home/features/global/gitui.nix old mode 100644 new mode 100755 diff --git a/home/features/global/nh.nix b/home/features/global/nh.nix old mode 100644 new mode 100755 diff --git a/home/features/global/qutebrowser.nix b/home/features/global/qutebrowser.nix old mode 100644 new mode 100755 diff --git a/home/features/global/shell.nix b/home/features/global/shell.nix old mode 100644 new mode 100755 index b7d2930..9423a9b --- a/home/features/global/shell.nix +++ b/home/features/global/shell.nix @@ -21,7 +21,7 @@ }; }; - home.persistence."/persist/${config.home.homeDirectory}" = { + home.persistence."/persist/generated/${config.home.homeDirectory}" = { directories = [ ".local/share/zoxide" ]; diff --git a/home/features/global/sops.nix b/home/features/global/sops.nix old mode 100644 new mode 100755 index de2ae20..1a5d397 --- a/home/features/global/sops.nix +++ b/home/features/global/sops.nix @@ -29,7 +29,7 @@ in { sessionVariables = { OPENAI_API_KEY = readSecretIfExists "api_keys/openai"; }; - persistence."/persist/${config.home.homeDirectory}".files = [ + persistence."/persist/generated/${config.home.homeDirectory}".files = [ ".config/sops/age/keys.txt" ]; }; diff --git a/home/features/global/tools.nix b/home/features/global/tools.nix old mode 100644 new mode 100755 diff --git a/home/features/global/wezterm.nix b/home/features/global/wezterm.nix old mode 100644 new mode 100755 diff --git a/home/features/global/wired-notify.nix b/home/features/global/wired-notify.nix old mode 100644 new mode 100755 diff --git a/home/features/global/zellij.nix b/home/features/global/zellij.nix old mode 100644 new mode 100755 diff --git a/home/features/hyprland/hyprlock.nix b/home/features/hyprland/hyprlock.nix old mode 100644 new mode 100755 diff --git a/home/features/impermanence.nix b/home/features/impermanence.nix old mode 100644 new mode 100755 index e21b8c9..d838f27 --- a/home/features/impermanence.nix +++ b/home/features/impermanence.nix @@ -7,19 +7,25 @@ inputs.impermanence.nixosModules.home-manager.impermanence ]; - home.persistence."/persist/${config.home.homeDirectory}" = { - directories = [ - "projects" - "documents" - "screenshots" + home.persistence = { + "/persist/data/${config.home.homeDirectory}" = { + directories = [ + "projects" + "documents" + "screenshots" + ]; + allowOther = true; + }; + "/persist/generated/${config.home.homeDirectory}" = { + directories = [ + ".config/Google" - ".config/Google" + ".local/share/keyrings" + ".local/share/Google" - ".local/share/keyrings" - ".local/share/Google" - - ".cache" - ]; - allowOther = true; + ".cache" + ]; + allowOther = true; + }; }; } diff --git a/home/features/neovim.nix b/home/features/neovim.nix old mode 100644 new mode 100755 index b9f6fba..bf9170e --- a/home/features/neovim.nix +++ b/home/features/neovim.nix @@ -19,7 +19,7 @@ in { shellAliases = { n = "nvim"; }; - persistence."/persist/${config.home.homeDirectory}".directories = [ + persistence."/persist/generated/${config.home.homeDirectory}".directories = [ ".local/share/nvim" ".npm" diff --git a/home/features/obsidian.nix b/home/features/obsidian.nix old mode 100644 new mode 100755 index a528615..c26ac91 --- a/home/features/obsidian.nix +++ b/home/features/obsidian.nix @@ -5,9 +5,13 @@ }: { home = { packages = [pkgs.obsidian]; - persistence."/persist/${config.home.homeDirectory}".directories = [ - "vaults" - ".config/obsidian" - ]; + persistence = { + "/persist/data/${config.home.homeDirectory}".directories = [ + "vaults" + ]; + "/persist/generated/${config.home.homeDirectory}".directories = [ + ".config/obsidian" + ]; + }; }; } diff --git a/home/features/ollama.nix b/home/features/ollama.nix old mode 100644 new mode 100755 diff --git a/home/features/ssh.nix b/home/features/ssh.nix old mode 100644 new mode 100755 index d3b539c..4fefde6 --- a/home/features/ssh.nix +++ b/home/features/ssh.nix @@ -1,5 +1,4 @@ { - lib, host-config, config, ... @@ -9,7 +8,7 @@ ".ssh/id_ed25519.pub".source = ../../host/${host-config.networking.hostName}/user_${config.home.username}_ssh_id_ed25519.pub; ".ssh/id_ed25519".source = config.sops.secrets."users/${config.home.username}/ssh_id_ed25519".path; }; - persistence."/persist/${config.home.homeDirectory}".directories = [ + persistence."/persist/generated/${config.home.homeDirectory}".directories = [ ".ssh" ]; }; diff --git a/home/features/walker/default.nix b/home/features/walker/default.nix old mode 100644 new mode 100755 diff --git a/home/features/walker/powermodule.nix b/home/features/walker/powermodule.nix old mode 100644 new mode 100755 diff --git a/home/features/yazi.nix b/home/features/yazi.nix old mode 100644 new mode 100755 diff --git a/home/features/yt-dlp.nix b/home/features/yt-dlp.nix old mode 100644 new mode 100755 diff --git a/home/fun/default.nix b/home/fun/default.nix old mode 100644 new mode 100755 index b9f707f..91b3a60 --- a/home/fun/default.nix +++ b/home/fun/default.nix @@ -36,12 +36,15 @@ jdk8 steam ]; - persistence."/persist/${config.home.homeDirectory}".directories = [ - "games" + persistence = { + "/persist/data/${config.home.homeDirectory}".directories = [ + "games" + ]; + "/persist/generated/${config.home.homeDirectory}".directories = [ + ".local/share/PrismLauncher" - ".local/share/PrismLauncher" - - ".local/share/Steam" - ]; + ".local/share/Steam" + ]; + }; }; } diff --git a/home/nikodem/default.nix b/home/nikodem/default.nix old mode 100644 new mode 100755 index 97828bb..263243b --- a/home/nikodem/default.nix +++ b/home/nikodem/default.nix @@ -46,7 +46,7 @@ zathura xh ]; - persistence."/persist/${config.home.homeDirectory}".directories = + persistence."/persist/generated/${config.home.homeDirectory}".directories = [ ".config/JetBrains" diff --git a/home/nm1/default.nix b/home/nm1/default.nix old mode 100644 new mode 100755 index d410117..f986456 --- a/home/nm1/default.nix +++ b/home/nm1/default.nix @@ -74,7 +74,7 @@ in { jetbrains.datagrip anysync ]; - persistence."/persist/${config.home.homeDirectory}".directories = [ + persistence."/persist/generated/${config.home.homeDirectory}".directories = [ ".config/Rocket.Chat" ".config/JetBrains" diff --git a/home/nm1/kanshi.nix b/home/nm1/kanshi.nix old mode 100644 new mode 100755 diff --git a/host/LP-043/m2_settings.xml b/host/LP-043/m2_settings.xml old mode 100644 new mode 100755 diff --git a/host/LP-043/networks.env b/host/LP-043/networks.env old mode 100644 new mode 100755 diff --git a/host/LP-043/openfortivpn_cert.pem b/host/LP-043/openfortivpn_cert.pem old mode 100644 new mode 100755 diff --git a/host/LP-043/openfortivpn_key.pem b/host/LP-043/openfortivpn_key.pem old mode 100644 new mode 100755 diff --git a/host/LP-043/secrets.nix b/host/LP-043/secrets.nix old mode 100644 new mode 100755 diff --git a/host/LP-043/secrets.yaml b/host/LP-043/secrets.yaml old mode 100644 new mode 100755 diff --git a/host/LP-043/ssh_host_ed25519_key.pub b/host/LP-043/ssh_host_ed25519_key.pub old mode 100644 new mode 100755 diff --git a/host/LP-043/user_nm1_ssh_id_ed25519.pub b/host/LP-043/user_nm1_ssh_id_ed25519.pub old mode 100644 new mode 100755 diff --git a/host/desktop/hardware-configuration.nix b/host/desktop/hardware-configuration.nix old mode 100644 new mode 100755 diff --git a/host/desktop/kanshi.nix b/host/desktop/kanshi.nix old mode 100644 new mode 100755 diff --git a/host/desktop/nextcloud.nix b/host/desktop/nextcloud.nix old mode 100644 new mode 100755 diff --git a/host/desktop/secrets.nix b/host/desktop/secrets.nix old mode 100644 new mode 100755 diff --git a/host/desktop/secrets.yaml b/host/desktop/secrets.yaml old mode 100644 new mode 100755 diff --git a/host/desktop/ssh_host_ed25519_key.pub b/host/desktop/ssh_host_ed25519_key.pub old mode 100644 new mode 100755 diff --git a/host/desktop/syncthing_cert.pem b/host/desktop/syncthing_cert.pem old mode 100644 new mode 100755 diff --git a/host/desktop/syncthing_key.pem b/host/desktop/syncthing_key.pem old mode 100644 new mode 100755 diff --git a/host/desktop/user_nikodem_ssh_id_ed25519.pub b/host/desktop/user_nikodem_ssh_id_ed25519.pub old mode 100644 new mode 100755 diff --git a/host/features/battery-saver.nix b/host/features/battery-saver.nix old mode 100644 new mode 100755 diff --git a/host/features/bluetooth.nix b/host/features/bluetooth.nix old mode 100644 new mode 100755 diff --git a/host/features/disko/btrfs-persistence-swapfile.nix b/host/features/disko/btrfs-persistence-swapfile.nix old mode 100644 new mode 100755 diff --git a/host/features/disko/btrfs-single-partition.nix b/host/features/disko/btrfs-single-partition.nix old mode 100644 new mode 100755 diff --git a/host/features/disko/default.nix b/host/features/disko/default.nix old mode 100644 new mode 100755 diff --git a/host/features/disko/device-btrfs-persistence.nix b/host/features/disko/device-btrfs-persistence.nix old mode 100644 new mode 100755 diff --git a/host/features/dnscrypt-proxy2.nix b/host/features/dnscrypt-proxy2.nix old mode 100644 new mode 100755 diff --git a/host/features/docker.nix b/host/features/docker.nix old mode 100644 new mode 100755 index c8ff0b0..ab18013 --- a/host/features/docker.nix +++ b/host/features/docker.nix @@ -23,7 +23,7 @@ }; }; - environment.persistence."/persist".directories = [ + environment.persistence."/persist/generated".directories = [ "/var/lib/docker" ]; } diff --git a/host/features/graphics.nix b/host/features/graphics.nix old mode 100644 new mode 100755 diff --git a/host/features/greetd.nix b/host/features/greetd.nix old mode 100644 new mode 100755 diff --git a/host/features/home-manager.nix b/host/features/home-manager.nix old mode 100644 new mode 100755 diff --git a/host/features/hyprland.nix b/host/features/hyprland.nix old mode 100644 new mode 100755 diff --git a/host/features/impermanence.nix b/host/features/impermanence.nix old mode 100644 new mode 100755 index f5997b7..44dd87a --- a/host/features/impermanence.nix +++ b/host/features/impermanence.nix @@ -55,33 +55,44 @@ fileSystems."/persist".neededForBoot = true; programs.fuse.userAllowOther = true; - environment.persistence."/persist" = { - hideMounts = true; - directories = [ - "/var/log" - "/var/lib/bluetooth" - "/var/lib/nixos" - "/var/lib/systemd" - "/var/lib/sops-nix" - "/etc/NetworkManager/system-connections" - { - directory = config.settings.configPath; - user = "root"; - group = "users"; - mode = "u=rwx,g=rwx,o=rx"; - } - ]; - files = [ - "/etc/machine-id" - ]; + environment.persistence = { + "/persist/data" = { + hideMounts = true; + directories = [ + { + directory = config.settings.configPath; + user = "root"; + group = "users"; + mode = "u=rwx,g=rwx,o=rx"; + } + ]; + }; + "/persist/generated" = { + hideMounts = true; + directories = [ + "/var/log" + "/var/lib/bluetooth" + "/var/lib/nixos" + "/var/lib/systemd" + "/var/lib/sops-nix" + "/etc/NetworkManager/system-connections" + ]; + files = [ + "/etc/machine-id" + ]; + }; }; system.activationScripts.persistent-dirs.text = let mkHomePersist = user: lib.optionalString user.createHome '' - mkdir -p /persist/${user.home} - chown ${user.name}:${user.group} /persist/${user.home} - chmod ${user.homeMode} /persist/${user.home} + mkdir -p /persist/data/${user.home} + chown ${user.name}:${user.group} /persist/data/${user.home} + chmod ${user.homeMode} /persist/data/${user.home} + + mkdir -p /persist/generated/${user.home} + chown ${user.name}:${user.group} /persist/generated/${user.home} + chmod ${user.homeMode} /persist/generated/${user.home} ''; users = lib.attrValues config.users.users; in diff --git a/host/features/networking.nix b/host/features/networking.nix old mode 100644 new mode 100755 diff --git a/host/features/ollama.nix b/host/features/ollama.nix old mode 100644 new mode 100755 index 31bff7e..071d417 --- a/host/features/ollama.nix +++ b/host/features/ollama.nix @@ -10,7 +10,7 @@ ]; }; - environment.persistence."/persist".directories = [ + environment.persistence."/persist/generated".directories = [ config.services.ollama.models ]; } diff --git a/host/features/openfortivpn.nix b/host/features/openfortivpn.nix old mode 100644 new mode 100755 diff --git a/host/features/openssh.nix b/host/features/openssh.nix old mode 100644 new mode 100755 index c742bf3..b6c84a2 --- a/host/features/openssh.nix +++ b/host/features/openssh.nix @@ -9,7 +9,7 @@ hostKeys = [ { - path = "/persist/etc/ssh/ssh_host_ed25519_key"; + path = "/persist/data/etc/ssh/ssh_host_ed25519_key"; type = "ed25519"; } ]; diff --git a/host/features/pipewire.nix b/host/features/pipewire.nix old mode 100644 new mode 100755 diff --git a/host/features/sops.nix b/host/features/sops.nix old mode 100644 new mode 100755 index e3c5883..bb1fcae --- a/host/features/sops.nix +++ b/host/features/sops.nix @@ -14,7 +14,7 @@ # FIXME: This does not seem right age = { - sshKeyPaths = ["/persist/etc/ssh/ssh_host_ed25519_key"]; + sshKeyPaths = ["/persist/data/etc/ssh/ssh_host_ed25519_key"]; }; }; diff --git a/host/features/stylix.nix b/host/features/stylix.nix old mode 100644 new mode 100755 diff --git a/host/features/sudo.nix b/host/features/sudo.nix old mode 100644 new mode 100755 diff --git a/host/features/syncthing.nix b/host/features/syncthing.nix old mode 100644 new mode 100755 diff --git a/host/features/time.nix b/host/features/time.nix old mode 100644 new mode 100755 diff --git a/host/features/tools.nix b/host/features/tools.nix old mode 100644 new mode 100755 diff --git a/host/features/virtualbox.nix b/host/features/virtualbox.nix old mode 100644 new mode 100755 diff --git a/host/features/zerotier.nix b/host/features/zerotier.nix old mode 100644 new mode 100755 diff --git a/host/laptop/hardware-configuration.nix b/host/laptop/hardware-configuration.nix index 9f7b549..d98a57e 100755 --- a/host/laptop/hardware-configuration.nix +++ b/host/laptop/hardware-configuration.nix @@ -16,8 +16,6 @@ boot.kernelModules = ["kvm-intel"]; boot.extraModulePackages = []; - swapDevices = []; - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's # still possible to use this option, but it's recommended to use it in conjunction diff --git a/host/laptop/kanshi.nix b/host/laptop/kanshi.nix old mode 100644 new mode 100755 diff --git a/host/laptop/secrets.nix b/host/laptop/secrets.nix old mode 100644 new mode 100755 diff --git a/host/laptop/secrets.yaml b/host/laptop/secrets.yaml old mode 100644 new mode 100755 diff --git a/host/laptop/ssh_host_ed25519_key.pub b/host/laptop/ssh_host_ed25519_key.pub old mode 100644 new mode 100755 diff --git a/host/laptop/user_nikodem_ssh_id_ed25519.pub b/host/laptop/user_nikodem_ssh_id_ed25519.pub old mode 100644 new mode 100755 diff --git a/modules/home/battery-notifier.nix b/modules/home/battery-notifier.nix old mode 100644 new mode 100755 diff --git a/modules/home/default.nix b/modules/home/default.nix old mode 100644 new mode 100755 diff --git a/modules/home/openfortivpn.nix b/modules/home/openfortivpn.nix old mode 100644 new mode 100755 diff --git a/modules/home/settings.nix b/modules/home/settings.nix old mode 100644 new mode 100755 diff --git a/modules/host/default.nix b/modules/host/default.nix old mode 100644 new mode 100755 diff --git a/modules/host/music.nix b/modules/host/music.nix old mode 100644 new mode 100755 diff --git a/modules/host/settings.nix b/modules/host/settings.nix old mode 100644 new mode 100755 diff --git a/pkgs/anysync.nix b/pkgs/anysync.nix old mode 100644 new mode 100755 diff --git a/pkgs/fabric-ai.nix b/pkgs/fabric-ai.nix old mode 100644 new mode 100755 diff --git a/secrets/api-keys.nix b/secrets/api-keys.nix old mode 100644 new mode 100755 diff --git a/secrets/api-keys.yaml b/secrets/api-keys.yaml old mode 100644 new mode 100755 diff --git a/secrets/networks.env b/secrets/networks.env old mode 100644 new mode 100755 diff --git a/secrets/networks.nix b/secrets/networks.nix old mode 100644 new mode 100755 diff --git a/shell.nix b/shell.nix old mode 100644 new mode 100755 index 82d80ab..6d743b5 --- a/shell.nix +++ b/shell.nix @@ -69,11 +69,11 @@ } trap cleanup EXIT - install -d -m755 "$temp/persist/etc/ssh" + install -d -m755 "$temp/persist/data/etc/ssh" - cat ./host/$1/ssh_host_ed25519_key > "$temp/persist/etc/ssh/ssh_host_ed25519_key" + cat ./host/$1/ssh_host_ed25519_key > "$temp/persist/data/etc/ssh/ssh_host_ed25519_key" - chmod 600 "$temp/persist/etc/ssh/ssh_host_ed25519_key" + chmod 600 "$temp/persist/data/etc/ssh/ssh_host_ed25519_key" nixos-anywhere --extra-files "$temp" --flake .#$1 $2 --option pure-eval false ''; From b95aa605ecd108081d5bc041c85e14c3bdc6c2a9 Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Sun, 3 Nov 2024 11:01:45 +0100 Subject: [PATCH 12/21] feat(config): removed settings and moved config path --- home/features/global/git.nix | 4 ++-- host/features/home-manager.nix | 2 -- host/features/impermanence.nix | 2 +- modules/home/default.nix | 1 - modules/home/settings.nix | 8 -------- modules/host/default.nix | 1 - modules/host/settings.nix | 8 -------- 7 files changed, 3 insertions(+), 23 deletions(-) delete mode 100755 modules/home/settings.nix delete mode 100755 modules/host/settings.nix diff --git a/home/features/global/git.nix b/home/features/global/git.nix index 6bb6d6f..62428c6 100755 --- a/home/features/global/git.nix +++ b/home/features/global/git.nix @@ -1,4 +1,4 @@ -{config, ...}: { +{ programs.git = { enable = true; aliases = { @@ -19,7 +19,7 @@ }; extraConfig = { init.defaultBranch = "main"; - safe.directory = config.settings.configPath; + safe.directory = "/etc/nixos"; }; }; diff --git a/host/features/home-manager.nix b/host/features/home-manager.nix index b621c6c..bc4f2c7 100755 --- a/host/features/home-manager.nix +++ b/host/features/home-manager.nix @@ -27,8 +27,6 @@ ]; home.username = user.name; - - settings = config.settings; }; }) (builtins.filter (user: (builtins.pathExists diff --git a/host/features/impermanence.nix b/host/features/impermanence.nix index 44dd87a..dc99a1d 100755 --- a/host/features/impermanence.nix +++ b/host/features/impermanence.nix @@ -60,7 +60,7 @@ hideMounts = true; directories = [ { - directory = config.settings.configPath; + directory = "/etc/nixos"; user = "root"; group = "users"; mode = "u=rwx,g=rwx,o=rx"; diff --git a/modules/home/default.nix b/modules/home/default.nix index a7f880b..2d723d9 100755 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -1,5 +1,4 @@ { - settings = import ./settings.nix; battery-notifier = import ./battery-notifier.nix; openfortivpn = import ./openfortivpn.nix; } diff --git a/modules/home/settings.nix b/modules/home/settings.nix deleted file mode 100755 index 074e832..0000000 --- a/modules/home/settings.nix +++ /dev/null @@ -1,8 +0,0 @@ -{lib, ...}: { - options.settings = { - configPath = lib.mkOption { - type = lib.types.str; - default = "/dotfiles"; - }; - }; -} diff --git a/modules/host/default.nix b/modules/host/default.nix index a547292..ec2f4fa 100755 --- a/modules/host/default.nix +++ b/modules/host/default.nix @@ -1,4 +1,3 @@ { - settings = import ./settings.nix; music = import ./music.nix; } diff --git a/modules/host/settings.nix b/modules/host/settings.nix deleted file mode 100755 index 074e832..0000000 --- a/modules/host/settings.nix +++ /dev/null @@ -1,8 +0,0 @@ -{lib, ...}: { - options.settings = { - configPath = lib.mkOption { - type = lib.types.str; - default = "/dotfiles"; - }; - }; -} From 59d4551e7168acb4477452bb9e15fa37dc601cf3 Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Sun, 3 Nov 2024 12:58:33 +0100 Subject: [PATCH 13/21] feat(persistence): simpler persist --- home/features/docker.nix | 17 ++- home/features/fabric-ai.nix | 15 ++- home/features/global/direnv.nix | 13 +-- home/features/global/firefox.nix | 2 +- home/features/global/gh.nix | 21 ++-- home/features/global/sops.nix | 13 +-- home/features/impermanence.nix | 68 ++++++++--- home/features/neovim.nix | 22 ++-- home/features/obsidian.nix | 25 ++--- home/features/ssh.nix | 15 ++- home/fun/default.nix | 36 +++--- home/nikodem/default.nix | 29 +++-- home/nm1/default.nix | 28 ++--- host/features/docker.nix | 2 +- host/features/impermanence.nix | 187 ++++++++++++++++++------------- host/features/ollama.nix | 2 +- 16 files changed, 262 insertions(+), 233 deletions(-) diff --git a/home/features/docker.nix b/home/features/docker.nix index 35e5f42..c95a53e 100755 --- a/home/features/docker.nix +++ b/home/features/docker.nix @@ -1,11 +1,10 @@ -{config, ...}: { - home = { - shellAliases = { - d = "docker"; - }; - persistence."/persist/generated/${config.home.homeDirectory}".directories = [ - ".docker" - ".dockercache" - ]; +{ + home.shellAliases = { + d = "docker"; }; + + persist.generated.directories = [ + ".docker" + ".dockercache" + ]; } diff --git a/home/features/fabric-ai.nix b/home/features/fabric-ai.nix index b653657..120469d 100755 --- a/home/features/fabric-ai.nix +++ b/home/features/fabric-ai.nix @@ -21,12 +21,11 @@ in { ${optionalString (builtins.hasAttr "api_keys/youtube" config.sops.secrets && builtins.pathExists config.sops.secrets."api_keys/youtube".path) "YOUTUBE_API_KEY=${builtins.readFile config.sops.secrets."api_keys/youtube".path}"} ''; - home = { - packages = with pkgs; [ - fabric-ai - ]; - persistence."/persist/generated/${config.home.homeDirectory}".directories = [ - ".config/fabric" - ]; - }; + home.packages = with pkgs; [ + fabric-ai + ]; + + persist.generated.directories = [ + ".config/fabric" + ]; } diff --git a/home/features/global/direnv.nix b/home/features/global/direnv.nix index fced433..5d53728 100755 --- a/home/features/global/direnv.nix +++ b/home/features/global/direnv.nix @@ -1,4 +1,4 @@ -{config, ...}: { +{ programs = { direnv = { enable = true; @@ -9,12 +9,7 @@ bash.enable = true; }; - home = { - shellAliases = { - direnvenable = "echo use nix > .envrc; direnv allow"; - }; - persistence."/persist/generated/${config.home.homeDirectory}".directories = [ - ".local/share/direnv" - ]; - }; + persist.generated.directories = [ + ".local/share/direnv" + ]; } diff --git a/home/features/global/firefox.nix b/home/features/global/firefox.nix index 7dd2886..cb4115e 100755 --- a/home/features/global/firefox.nix +++ b/home/features/global/firefox.nix @@ -22,7 +22,7 @@ }; }; - home.persistence."/persist/generated/${config.home.homeDirectory}".directories = [ + persist.generated.directories = [ ".mozilla" ]; } diff --git a/home/features/global/gh.nix b/home/features/global/gh.nix index fe7ec5e..18bb0c9 100755 --- a/home/features/global/gh.nix +++ b/home/features/global/gh.nix @@ -1,8 +1,4 @@ -{ - pkgs, - config, - ... -}: { +{pkgs, ...}: { programs.gh = { enable = true; settings = { @@ -13,13 +9,12 @@ ]; }; - home = { - shellAliases = { - ghsg = "gh copilot suggest --target shell '$_'"; - }; - persistence."/persist/generated/${config.home.homeDirectory}".directories = [ - ".config/github-copilot" - ".local/share/gh" - ]; + home.shellAliases = { + ghsg = "gh copilot suggest --target shell '$_'"; }; + + persist.generated.directories = [ + ".config/github-copilot" + ".local/share/gh" + ]; } diff --git a/home/features/global/sops.nix b/home/features/global/sops.nix index 1a5d397..dc7d109 100755 --- a/home/features/global/sops.nix +++ b/home/features/global/sops.nix @@ -25,12 +25,11 @@ in { defaultSopsFile = ../../../host/${host-config.networking.hostName}/secrets.yaml; }; - home = { - sessionVariables = { - OPENAI_API_KEY = readSecretIfExists "api_keys/openai"; - }; - persistence."/persist/generated/${config.home.homeDirectory}".files = [ - ".config/sops/age/keys.txt" - ]; + home.sessionVariables = { + OPENAI_API_KEY = readSecretIfExists "api_keys/openai"; }; + + persist.generated.files = [ + ".config/sops/age/keys.txt" + ]; } diff --git a/home/features/impermanence.nix b/home/features/impermanence.nix index d838f27..5dd9fc5 100755 --- a/home/features/impermanence.nix +++ b/home/features/impermanence.nix @@ -1,5 +1,6 @@ { inputs, + lib, config, ... }: { @@ -7,25 +8,60 @@ inputs.impermanence.nixosModules.home-manager.impermanence ]; - home.persistence = { - "/persist/data/${config.home.homeDirectory}" = { - directories = [ - "projects" - "documents" - "screenshots" - ]; - allowOther = true; + options.persist = let + inherit (lib) mkOption; + inherit (lib.types) submodule listOf str; + + peristSub = { + options = { + directories = mkOption { + type = listOf str; + default = []; + }; + files = mkOption { + type = listOf str; + default = []; + }; + }; + }; + in { + data = mkOption { + type = submodule peristSub; + default = {}; + }; + generated = mkOption { + type = submodule peristSub; + default = {}; }; - "/persist/generated/${config.home.homeDirectory}" = { - directories = [ - ".config/Google" + }; + + config = { + home.persistence = { + "/persist/data/${config.home.homeDirectory}" = { + directories = + [ + "projects" + "documents" + "screenshots" + ] + ++ config.persist.data.directories; + files = config.persist.data.files; + allowOther = true; + }; + "/persist/generated/${config.home.homeDirectory}" = { + directories = + [ + ".config/Google" - ".local/share/keyrings" - ".local/share/Google" + ".local/share/keyrings" + ".local/share/Google" - ".cache" - ]; - allowOther = true; + ".cache" + ] + ++ config.persist.generated.directories; + files = config.persist.generated.files; + allowOther = true; + }; }; }; } diff --git a/home/features/neovim.nix b/home/features/neovim.nix index bf9170e..ed03747 100755 --- a/home/features/neovim.nix +++ b/home/features/neovim.nix @@ -1,7 +1,6 @@ { inputs, pkgs, - config, ... }: let neovim = inputs.neovim.packages.${pkgs.system}.default.extend {}; @@ -19,15 +18,16 @@ in { shellAliases = { n = "nvim"; }; - persistence."/persist/generated/${config.home.homeDirectory}".directories = [ - ".local/share/nvim" - - ".npm" - ".cargo" - ".java" - ".gradle" - ".m2" - ".android" - ]; }; + + persist.generated.directories = [ + ".local/share/nvim" + + ".npm" + ".cargo" + ".java" + ".gradle" + ".m2" + ".android" + ]; } diff --git a/home/features/obsidian.nix b/home/features/obsidian.nix index c26ac91..00afb3d 100755 --- a/home/features/obsidian.nix +++ b/home/features/obsidian.nix @@ -1,17 +1,12 @@ -{ - pkgs, - config, - ... -}: { - home = { - packages = [pkgs.obsidian]; - persistence = { - "/persist/data/${config.home.homeDirectory}".directories = [ - "vaults" - ]; - "/persist/generated/${config.home.homeDirectory}".directories = [ - ".config/obsidian" - ]; - }; +{pkgs, ...}: { + home.packages = [pkgs.obsidian]; + + persist = { + data.directories = [ + "vaults" + ]; + generated.directories = [ + ".config/obsidian" + ]; }; } diff --git a/home/features/ssh.nix b/home/features/ssh.nix index 4fefde6..d25caa2 100755 --- a/home/features/ssh.nix +++ b/home/features/ssh.nix @@ -3,13 +3,12 @@ config, ... }: { - home = { - file = { - ".ssh/id_ed25519.pub".source = ../../host/${host-config.networking.hostName}/user_${config.home.username}_ssh_id_ed25519.pub; - ".ssh/id_ed25519".source = config.sops.secrets."users/${config.home.username}/ssh_id_ed25519".path; - }; - persistence."/persist/generated/${config.home.homeDirectory}".directories = [ - ".ssh" - ]; + home.file = { + ".ssh/id_ed25519.pub".source = ../../host/${host-config.networking.hostName}/user_${config.home.username}_ssh_id_ed25519.pub; + ".ssh/id_ed25519".source = config.sops.secrets."users/${config.home.username}/ssh_id_ed25519".path; }; + + persist.generated.directories = [ + ".ssh" + ]; } diff --git a/home/fun/default.nix b/home/fun/default.nix index 91b3a60..03d5a89 100755 --- a/home/fun/default.nix +++ b/home/fun/default.nix @@ -2,7 +2,6 @@ pkgs, lib, host-config, - config, ... }: { imports = [ @@ -26,25 +25,24 @@ }; }; - home = { - packages = with pkgs; [ - rnote - beeper - zathura - lutris - prismlauncher - jdk8 - steam + home.packages = with pkgs; [ + rnote + beeper + zathura + lutris + prismlauncher + jdk8 + steam + ]; + + persist = { + data.directories = [ + "games" ]; - persistence = { - "/persist/data/${config.home.homeDirectory}".directories = [ - "games" - ]; - "/persist/generated/${config.home.homeDirectory}".directories = [ - ".local/share/PrismLauncher" + generated.directories = [ + ".local/share/PrismLauncher" - ".local/share/Steam" - ]; - }; + ".local/share/Steam" + ]; }; } diff --git a/home/nikodem/default.nix b/home/nikodem/default.nix index 263243b..2a5c78a 100755 --- a/home/nikodem/default.nix +++ b/home/nikodem/default.nix @@ -2,7 +2,6 @@ pkgs, lib, host-config, - config, ... }: { imports = [ @@ -38,20 +37,20 @@ }; }; - home = { - packages = with pkgs; [ - rnote - beeper - typst - zathura - xh - ]; - persistence."/persist/generated/${config.home.homeDirectory}".directories = - [ - ".config/JetBrains" + home.packages = with pkgs; [ + rnote + beeper + typst + zathura + xh + ]; - ".local/share/JetBrains" - ] - ++ lib.optional host-config.virtualisation.virtualbox.host.enable "vms"; + persist = { + generated.directories = [ + ".config/JetBrains" + + ".local/share/JetBrains" + ]; + data.directories = lib.optional host-config.virtualisation.virtualbox.host.enable "vms"; }; } diff --git a/home/nm1/default.nix b/home/nm1/default.nix index f986456..4bfffce 100755 --- a/home/nm1/default.nix +++ b/home/nm1/default.nix @@ -1,8 +1,4 @@ -{ - pkgs, - config, - ... -}: let +{pkgs, ...}: let # FIXME: Temporary solution that only works if secrets are already present on the host. readIfExists = path: if builtins.pathExists path @@ -74,24 +70,14 @@ in { jetbrains.datagrip anysync ]; - persistence."/persist/generated/${config.home.homeDirectory}".directories = [ - ".config/Rocket.Chat" - ".config/JetBrains" - - ".local/share/JetBrains" - ]; }; - programs.bun.settings = { - # install."@softnet-ng" = { - # url = readIfExists config.sops.secrets."users/nm1/npm/url".path; - # username = readIfExists config.sops.secrets."users/nm1/npm/username".path; - # password = readIfExists config.sops.secrets."users/nm1/npm/password".path; - # https-proxy = readIfExists config.sops.secrets."users/nm1/npm/url".path; - # noproxy = readIfExists config.sops.secrets."users/nm1/npm/url".path; - # strict-ssl = true; - # }; - }; + persist.generated.directories = [ + ".config/Rocket.Chat" + ".config/JetBrains" + + ".local/share/JetBrains" + ]; wayland.windowManager.hyprland.settings.exec-once = [ "[workspace 1 silent] ${pkgs.rocketchat-desktop}/bin/rocketchat-desktop" diff --git a/host/features/docker.nix b/host/features/docker.nix index ab18013..33ab4ea 100755 --- a/host/features/docker.nix +++ b/host/features/docker.nix @@ -23,7 +23,7 @@ }; }; - environment.persistence."/persist/generated".directories = [ + persist.generated.directories = [ "/var/lib/docker" ]; } diff --git a/host/features/impermanence.nix b/host/features/impermanence.nix index dc99a1d..22d7cf5 100755 --- a/host/features/impermanence.nix +++ b/host/features/impermanence.nix @@ -8,93 +8,122 @@ inputs.impermanence.nixosModules.impermanence ]; - boot.initrd = { - supportedFilesystems = ["btrfs"]; - systemd = { - enable = true; - services.rollback = { - description = "Rollback BTRFS root subvolume to a pristine state"; - wantedBy = [ - "initrd.target" - ]; - before = [ - "sysroot.mount" - ]; - requires = ["dev-nvme0n1p2.device"]; - after = ["dev-nvme0n1p2.device"]; - unitConfig.DefaultDependencies = "no"; - serviceConfig.Type = "oneshot"; - script = '' - mkdir /btrfs_tmp - mount /dev/disk/by-partlabel/disk-main-root /btrfs_tmp - if [[ -e /btrfs_tmp/root ]]; then - mkdir -p /btrfs_tmp/old_roots - timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S") - mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp" - fi - - delete_subvolume_recursively() { - IFS=$'\n' - for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do - delete_subvolume_recursively "/btrfs_tmp/$i" - done - btrfs subvolume delete "$1" - } - - for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do - delete_subvolume_recursively "$i" - done + options.persist = let + inherit (lib) mkOption; + inherit (lib.types) submodule listOf str; - btrfs subvolume create /btrfs_tmp/root - umount /btrfs_tmp - ''; + peristSub = { + options = { + directories = mkOption { + type = listOf str; + default = []; + }; + files = mkOption { + type = listOf str; + default = []; + }; }; }; + in { + data = mkOption { + type = submodule peristSub; + default = {}; + }; + generated = mkOption { + type = submodule peristSub; + default = {}; + }; }; - fileSystems."/persist".neededForBoot = true; - programs.fuse.userAllowOther = true; + config = { + boot.initrd = { + supportedFilesystems = ["btrfs"]; + systemd = { + enable = true; + services.rollback = { + description = "Rollback BTRFS root subvolume to a pristine state"; + wantedBy = [ + "initrd.target" + ]; + before = [ + "sysroot.mount" + ]; + requires = ["dev-nvme0n1p2.device"]; + after = ["dev-nvme0n1p2.device"]; + unitConfig.DefaultDependencies = "no"; + serviceConfig.Type = "oneshot"; + script = '' + mkdir /btrfs_tmp + mount /dev/disk/by-partlabel/disk-main-root /btrfs_tmp + if [[ -e /btrfs_tmp/root ]]; then + mkdir -p /btrfs_tmp/old_roots + timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S") + mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp" + fi + + delete_subvolume_recursively() { + IFS=$'\n' + for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do + delete_subvolume_recursively "/btrfs_tmp/$i" + done + btrfs subvolume delete "$1" + } - environment.persistence = { - "/persist/data" = { - hideMounts = true; - directories = [ - { - directory = "/etc/nixos"; - user = "root"; - group = "users"; - mode = "u=rwx,g=rwx,o=rx"; - } - ]; + for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do + delete_subvolume_recursively "$i" + done + + btrfs subvolume create /btrfs_tmp/root + umount /btrfs_tmp + ''; + }; + }; }; - "/persist/generated" = { - hideMounts = true; - directories = [ - "/var/log" - "/var/lib/bluetooth" - "/var/lib/nixos" - "/var/lib/systemd" - "/var/lib/sops-nix" - "/etc/NetworkManager/system-connections" - ]; - files = [ - "/etc/machine-id" - ]; + + fileSystems."/persist".neededForBoot = true; + programs.fuse.userAllowOther = true; + + environment.persistence = { + "/persist/data" = { + hideMounts = true; + directories = [ + { + directory = "/etc/nixos"; + user = "root"; + group = "users"; + mode = "u=rwx,g=rwx,o=rx"; + } + ]; + }; + "/persist/generated" = { + hideMounts = true; + directories = [ + "/var/log" + "/var/lib/bluetooth" + "/var/lib/nixos" + "/var/lib/systemd" + "/var/lib/sops-nix" + "/etc/NetworkManager/system-connections" + ]; + files = [ + "/etc/machine-id" + ]; + }; }; - }; - system.activationScripts.persistent-dirs.text = let - mkHomePersist = user: - lib.optionalString user.createHome '' - mkdir -p /persist/data/${user.home} - chown ${user.name}:${user.group} /persist/data/${user.home} - chmod ${user.homeMode} /persist/data/${user.home} + system.activationScripts.persistent-dirs.text = let + mkHomePersist = user: + lib.optionalString user.createHome '' + mkdir -p /persist/data/${user.home} + chown ${user.name}:${user.group} /persist/data/${user.home} + chmod ${user.homeMode} /persist/data/${user.home} - mkdir -p /persist/generated/${user.home} - chown ${user.name}:${user.group} /persist/generated/${user.home} - chmod ${user.homeMode} /persist/generated/${user.home} - ''; - users = lib.attrValues config.users.users; - in - lib.concatLines (map mkHomePersist users); + mkdir -p /persist/generated/${user.home} + chown ${user.name}:${user.group} /persist/generated/${user.home} + chmod ${user.homeMode} /persist/generated/${user.home} + ''; + users = lib.attrValues config.users.users; + in + lib.concatLines (map mkHomePersist users); + }; } diff --git a/host/features/ollama.nix b/host/features/ollama.nix index 071d417..e2a8f29 100755 --- a/host/features/ollama.nix +++ b/host/features/ollama.nix @@ -10,7 +10,7 @@ ]; }; - environment.persistence."/persist/generated".directories = [ + persist.generated.directories = [ config.services.ollama.models ]; } From 883a1595653ef095d81efdcd2e6fd8ae4a55fd47 Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Sun, 3 Nov 2024 15:48:47 +0100 Subject: [PATCH 14/21] refactor(persist): as module --- home/ctf/default.nix | 1 - home/features/global/shell.nix | 4 +- home/features/impermanence.nix | 67 ----------------- home/fun/default.nix | 1 - home/nikodem/default.nix | 1 - home/nm1/default.nix | 1 - host/LP-043/default.nix | 6 +- host/desktop/default.nix | 6 +- host/features/impermanence.nix | 129 ------------------------------- host/laptop/default.nix | 6 +- modules/home/default.nix | 1 + modules/home/persist.nix | 49 ++++++++++++ modules/host/default.nix | 2 +- modules/host/music.nix | 134 --------------------------------- modules/host/persist.nix | 116 ++++++++++++++++++++++++++++ modules/shared/persist.nix | 36 +++++++++ 16 files changed, 220 insertions(+), 340 deletions(-) delete mode 100755 home/features/impermanence.nix delete mode 100755 host/features/impermanence.nix create mode 100755 modules/home/persist.nix delete mode 100755 modules/host/music.nix create mode 100755 modules/host/persist.nix create mode 100644 modules/shared/persist.nix diff --git a/home/ctf/default.nix b/home/ctf/default.nix index 9d5bda7..56660b7 100755 --- a/home/ctf/default.nix +++ b/home/ctf/default.nix @@ -9,7 +9,6 @@ ../features/hyprland ../features/neovim.nix - ../features/impermanence.nix ../features/docker.nix ../features/obsidian.nix ../features/fabric-ai.nix diff --git a/home/features/global/shell.nix b/home/features/global/shell.nix index 9423a9b..ade108b 100755 --- a/home/features/global/shell.nix +++ b/home/features/global/shell.nix @@ -1,4 +1,4 @@ -{config, ...}: { +{ imports = [ ./zellij.nix ./direnv.nix @@ -21,7 +21,7 @@ }; }; - home.persistence."/persist/generated/${config.home.homeDirectory}" = { + persist.generated = { directories = [ ".local/share/zoxide" ]; diff --git a/home/features/impermanence.nix b/home/features/impermanence.nix deleted file mode 100755 index 5dd9fc5..0000000 --- a/home/features/impermanence.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ - inputs, - lib, - config, - ... -}: { - imports = [ - inputs.impermanence.nixosModules.home-manager.impermanence - ]; - - options.persist = let - inherit (lib) mkOption; - inherit (lib.types) submodule listOf str; - - peristSub = { - options = { - directories = mkOption { - type = listOf str; - default = []; - }; - files = mkOption { - type = listOf str; - default = []; - }; - }; - }; - in { - data = mkOption { - type = submodule peristSub; - default = {}; - }; - generated = mkOption { - type = submodule peristSub; - default = {}; - }; - }; - - config = { - home.persistence = { - "/persist/data/${config.home.homeDirectory}" = { - directories = - [ - "projects" - "documents" - "screenshots" - ] - ++ config.persist.data.directories; - files = config.persist.data.files; - allowOther = true; - }; - "/persist/generated/${config.home.homeDirectory}" = { - directories = - [ - ".config/Google" - - ".local/share/keyrings" - ".local/share/Google" - - ".cache" - ] - ++ config.persist.generated.directories; - files = config.persist.generated.files; - allowOther = true; - }; - }; - }; -} diff --git a/home/fun/default.nix b/home/fun/default.nix index 03d5a89..3d98b6c 100755 --- a/home/fun/default.nix +++ b/home/fun/default.nix @@ -10,7 +10,6 @@ ../features/hyprland ../features/neovim.nix - ../features/impermanence.nix ../features/beets.nix ../features/yt-dlp.nix ]; diff --git a/home/nikodem/default.nix b/home/nikodem/default.nix index 2a5c78a..d03ad43 100755 --- a/home/nikodem/default.nix +++ b/home/nikodem/default.nix @@ -10,7 +10,6 @@ ../features/hyprland ../features/neovim.nix - ../features/impermanence.nix ../features/ssh.nix ../features/docker.nix ../features/beets.nix diff --git a/home/nm1/default.nix b/home/nm1/default.nix index 4bfffce..30163e8 100755 --- a/home/nm1/default.nix +++ b/home/nm1/default.nix @@ -11,7 +11,6 @@ in { ../features/hyprland ../features/neovim.nix - ../features/impermanence.nix ../features/ssh.nix ../features/docker.nix ../features/bun.nix diff --git a/host/LP-043/default.nix b/host/LP-043/default.nix index 5281c12..2d93c25 100755 --- a/host/LP-043/default.nix +++ b/host/LP-043/default.nix @@ -12,7 +12,6 @@ swap = 38; }) - ../features/impermanence.nix ../features/hyprland.nix ../features/docker.nix @@ -40,6 +39,11 @@ }; }; + persist = { + enable = true; + device = "nvme0n1p2"; + }; + users.users = { nm1 = { isNormalUser = true; diff --git a/host/desktop/default.nix b/host/desktop/default.nix index 9145a32..ddfed02 100755 --- a/host/desktop/default.nix +++ b/host/desktop/default.nix @@ -15,7 +15,6 @@ device = "/dev/sda"; }) - ../features/impermanence.nix ../features/hyprland.nix ../features/docker.nix ../features/dnscrypt-proxy2.nix @@ -27,6 +26,11 @@ networking.hostName = "desktop"; + persist = { + enable = true; + device = "nvme0n1p2"; + }; + users.users = { nikodem = { isNormalUser = true; diff --git a/host/features/impermanence.nix b/host/features/impermanence.nix deleted file mode 100755 index 22d7cf5..0000000 --- a/host/features/impermanence.nix +++ /dev/null @@ -1,129 +0,0 @@ -{ - inputs, - lib, - config, - ... -}: { - imports = [ - inputs.impermanence.nixosModules.impermanence - ]; - - options.persist = let - inherit (lib) mkOption; - inherit (lib.types) submodule listOf str; - - peristSub = { - options = { - directories = mkOption { - type = listOf str; - default = []; - }; - files = mkOption { - type = listOf str; - default = []; - }; - }; - }; - in { - data = mkOption { - type = submodule peristSub; - default = {}; - }; - generated = mkOption { - type = submodule peristSub; - default = {}; - }; - }; - - config = { - boot.initrd = { - supportedFilesystems = ["btrfs"]; - systemd = { - enable = true; - services.rollback = { - description = "Rollback BTRFS root subvolume to a pristine state"; - wantedBy = [ - "initrd.target" - ]; - before = [ - "sysroot.mount" - ]; - requires = ["dev-nvme0n1p2.device"]; - after = ["dev-nvme0n1p2.device"]; - unitConfig.DefaultDependencies = "no"; - serviceConfig.Type = "oneshot"; - script = '' - mkdir /btrfs_tmp - mount /dev/disk/by-partlabel/disk-main-root /btrfs_tmp - if [[ -e /btrfs_tmp/root ]]; then - mkdir -p /btrfs_tmp/old_roots - timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S") - mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp" - fi - - delete_subvolume_recursively() { - IFS=$'\n' - for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do - delete_subvolume_recursively "/btrfs_tmp/$i" - done - btrfs subvolume delete "$1" - } - - for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do - delete_subvolume_recursively "$i" - done - - btrfs subvolume create /btrfs_tmp/root - umount /btrfs_tmp - ''; - }; - }; - }; - - fileSystems."/persist".neededForBoot = true; - programs.fuse.userAllowOther = true; - - environment.persistence = { - "/persist/data" = { - hideMounts = true; - directories = [ - { - directory = "/etc/nixos"; - user = "root"; - group = "users"; - mode = "u=rwx,g=rwx,o=rx"; - } - ]; - }; - "/persist/generated" = { - hideMounts = true; - directories = [ - "/var/log" - "/var/lib/bluetooth" - "/var/lib/nixos" - "/var/lib/systemd" - "/var/lib/sops-nix" - "/etc/NetworkManager/system-connections" - ]; - files = [ - "/etc/machine-id" - ]; - }; - }; - - system.activationScripts.persistent-dirs.text = let - mkHomePersist = user: - lib.optionalString user.createHome '' - mkdir -p /persist/data/${user.home} - chown ${user.name}:${user.group} /persist/data/${user.home} - chmod ${user.homeMode} /persist/data/${user.home} - - mkdir -p /persist/generated/${user.home} - chown ${user.name}:${user.group} /persist/generated/${user.home} - chmod ${user.homeMode} /persist/generated/${user.home} - ''; - users = lib.attrValues config.users.users; - in - lib.concatLines (map mkHomePersist users); - }; -} diff --git a/host/laptop/default.nix b/host/laptop/default.nix index 645efd9..8a78cb5 100755 --- a/host/laptop/default.nix +++ b/host/laptop/default.nix @@ -12,7 +12,6 @@ swap = 15; }) - ../features/impermanence.nix ../features/hyprland.nix ../features/docker.nix ../features/dnscrypt-proxy2.nix @@ -23,6 +22,11 @@ networking.hostName = "laptop"; + persist = { + enable = true; + device = "nvme0n1p2"; + }; + users.users = { nikodem = { isNormalUser = true; diff --git a/modules/home/default.nix b/modules/home/default.nix index 2d723d9..362090e 100755 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -1,4 +1,5 @@ { battery-notifier = import ./battery-notifier.nix; + persist = import ./persist.nix; openfortivpn = import ./openfortivpn.nix; } diff --git a/modules/home/persist.nix b/modules/home/persist.nix new file mode 100755 index 0000000..8b967ab --- /dev/null +++ b/modules/home/persist.nix @@ -0,0 +1,49 @@ +{ + inputs, + lib, + host-config, + config, + ... +}: { + imports = [ + ../shared/persist.nix + + inputs.impermanence.nixosModules.home-manager.impermanence + ]; + + config = let + host-cfg = host-config.persist; + cfg = config.persist; + + inherit (lib) mkIf; + in + mkIf (host-cfg.enable || cfg.enable) { + home.persistence = { + "/persist/data/${config.home.homeDirectory}" = { + directories = + [ + "projects" + "documents" + "screenshots" + ] + ++ cfg.data.directories; + files = cfg.data.files; + allowOther = true; + }; + "/persist/generated/${config.home.homeDirectory}" = { + directories = + [ + ".config/Google" + + ".local/share/keyrings" + ".local/share/Google" + + ".cache" + ] + ++ cfg.generated.directories; + files = cfg.generated.files; + allowOther = true; + }; + }; + }; +} diff --git a/modules/host/default.nix b/modules/host/default.nix index ec2f4fa..cac121c 100755 --- a/modules/host/default.nix +++ b/modules/host/default.nix @@ -1,3 +1,3 @@ { - music = import ./music.nix; + persist = import ./persist.nix; } diff --git a/modules/host/music.nix b/modules/host/music.nix deleted file mode 100755 index 272ee39..0000000 --- a/modules/host/music.nix +++ /dev/null @@ -1,134 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: let - cfg = config.services.music; - - config-beets = pkgs.writeText "config-beets.yaml" '' - directory: ${cfg.path}/data - import: - move: true - duplicate_action: merge - library: ${cfg.path}/musiclib.db - paths: - default: $albumartist/$album%aunique{}/$title - singleton: singles/$artist/$title - ''; - - # TODO: Turn this into a separate module - anysync-config = pkgs.writeText "anysync-config.toml" '' - port = 5060 - - [sources.music] - path = "${cfg.path}/data" - actions = "get" - ''; - - nix-shell = pkgs.writeText "nix-shell.nix" '' - {pkgs ? import {}}: let - alias-beets = pkgs.writeShellScriptBin "b" "beet -c ${config-beets} $@"; - - alias-get-single = pkgs.writeShellScriptBin "get-single" - '''yt-dlp --default-search "https://music.youtube.com/search/?q=" --embed-metadata --embed-thumbnail -f bestaudio -x --audio-format flac -P ${cfg.path}/to-add --playlist-items 1 :"$1"; beet -c ${config-beets} import --quiet --singletons ${cfg.path}/to-add'''; - alias-get-playlist-url = pkgs.writeShellScriptBin "get-playlist-url" - '''yt-dlp --embed-metadata --embed-thumbnail -f bestaudio -x --audio-format flac -P ${cfg.path}/to-add :"$1"; beet -c ${config-beets} import --quiet --group-albums ${cfg.path}/to-add'''; - in - pkgs.mkShell { - packages = with pkgs; [yt-dlp beets]; - buildInputs = with pkgs; [yt-dlp beets] ++ [alias-beets alias-get-single alias-get-playlist-url]; - shellHook = ''' - printf "\e[33m - \e[1mget-single \"\" \e[0m\e[33m -> get single and import it to the library - \e[1mget-playlist-url \"\"\e[0m\e[33m -> get playlist and import it to the library - \e[0m" - '''; - } - ''; -in { - options.services.music = { - enable = lib.mkEnableOption "Enable music service"; - - path = lib.mkOption { - type = lib.types.str; - default = "/home/music"; - description = "Path to music library"; - }; - - anysync = lib.mkEnableOption "Enable anysync server"; - - persistent = lib.mkEnableOption "Enable if persistence is needed"; - }; - - config = lib.mkIf cfg.enable { - users = { - groups.music = {}; - users.music = { - isNormalUser = true; - uid = 1100; - createHome = false; - hashedPasswordFile = lib.mkIf (builtins.hasAttr "users/music/password" config.sops.secrets) config.sops.secrets."users/music/password".path; - extraGroups = ["music"]; - - # TODO: change this to custom shell - useDefaultShell = false; - shell = pkgs.bashInteractive; - }; - }; - systemd.tmpfiles.rules = [ - "d ${cfg.path} 0774 music music -" - "d ${cfg.path}/data 0774 music music -" - "d ${cfg.path}/to-add 0774 music music -" - "f ${cfg.path}/musiclib.db 0774 music music -" - - "f ${cfg.path}/.envrc 0444 music music - use nix ${nix-shell}" # enable direnv shell - ]; - - systemd.services.anysync-music = lib.mkIf cfg.anysync { - enable = true; - description = "anysync server with music"; - - wantedBy = ["multi-user.target"]; - - serviceConfig = { - Type = "simple"; - ExecStart = "${pkgs.anysync}/bin/anysync-server -c ${anysync-config}"; - Restart = "always"; - }; - }; - - environment.persistence."/persist" = lib.mkIf cfg.persistent { - directories = [ - { - directory = cfg.path; - user = "music"; - group = "music"; - mode = "u=rwx,g=rwx,o=rx"; - } - { - directory = "${cfg.path}/data"; - user = "music"; - group = "music"; - mode = "u=rwx,g=rwx,o=rx"; - } - { - directory = "${cfg.path}/to-add"; - user = "music"; - group = "music"; - mode = "u=rwx,g=rwx,o=rx"; - } - ]; - files = [ - { - file = "${cfg.path}/musiclib.db"; - parentDirectory = {mode = "u=rwx,g=rwx,o=rx";}; - } - { - file = "${cfg.path}/.envrc"; - parentDirectory = {mode = "u=rx,g=rx,o=rx";}; - } - ]; - }; - }; -} diff --git a/modules/host/persist.nix b/modules/host/persist.nix new file mode 100755 index 0000000..14ae859 --- /dev/null +++ b/modules/host/persist.nix @@ -0,0 +1,116 @@ +{ + inputs, + lib, + config, + ... +}: { + imports = [ + ../shared/persist.nix + + inputs.impermanence.nixosModules.impermanence + ]; + + config = let + cfg = config.persist; + + inherit (lib) mkIf; + in + mkIf cfg.enable { + boot.initrd = { + supportedFilesystems = ["btrfs"]; + systemd = { + enable = true; + services.rollback = { + description = "Rollback BTRFS root subvolume to a pristine state"; + wantedBy = [ + "initrd.target" + ]; + before = [ + "sysroot.mount" + ]; + requires = ["dev-${cfg.device}.device"]; + after = ["dev-${cfg.device}.device"]; + unitConfig.DefaultDependencies = "no"; + serviceConfig.Type = "oneshot"; + script = '' + mkdir /btrfs_tmp + mount /dev/${cfg.device} /btrfs_tmp + if [[ -e /btrfs_tmp/root ]]; then + mkdir -p /btrfs_tmp/old_roots + timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S") + mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp" + fi + + delete_subvolume_recursively() { + IFS=$'\n' + for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do + delete_subvolume_recursively "/btrfs_tmp/$i" + done + btrfs subvolume delete "$1" + } + + for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do + delete_subvolume_recursively "$i" + done + + btrfs subvolume create /btrfs_tmp/root + umount /btrfs_tmp + ''; + }; + }; + }; + + fileSystems."/persist".neededForBoot = true; + programs.fuse.userAllowOther = true; + + environment.persistence = { + "/persist/data" = { + hideMounts = true; + directories = + [ + { + directory = "/etc/nixos"; + user = "root"; + group = "users"; + mode = "u=rwx,g=rwx,o=rx"; + } + ] + ++ cfg.data.directories; + files = cfg.data.files; + }; + "/persist/generated" = { + hideMounts = true; + directories = + [ + "/var/log" + "/var/lib/bluetooth" + "/var/lib/nixos" + "/var/lib/systemd" + "/var/lib/sops-nix" + "/etc/NetworkManager/system-connections" + ] + ++ cfg.generated.directories; + files = + [ + "/etc/machine-id" + ] + ++ cfg.generated.files; + }; + }; + + system.activationScripts.persistent-dirs.text = let + mkHomePersist = user: + lib.optionalString user.createHome '' + mkdir -p /persist/data/${user.home} + chown ${user.name}:${user.group} /persist/data/${user.home} + chmod ${user.homeMode} /persist/data/${user.home} + + mkdir -p /persist/generated/${user.home} + chown ${user.name}:${user.group} /persist/generated/${user.home} + chmod ${user.homeMode} /persist/generated/${user.home} + ''; + users = lib.attrValues config.users.users; + in + lib.concatLines (map mkHomePersist users); + }; +} diff --git a/modules/shared/persist.nix b/modules/shared/persist.nix new file mode 100644 index 0000000..f09dca3 --- /dev/null +++ b/modules/shared/persist.nix @@ -0,0 +1,36 @@ +{lib, ...}: { + options.persist = let + inherit (lib) mkEnableOption mkOption; + inherit (lib.types) submodule listOf str; + + peristentCategory = { + options = { + directories = mkOption { + type = listOf str; + default = []; + }; + files = mkOption { + type = listOf str; + default = []; + }; + }; + }; + in { + enable = mkEnableOption "Enable impermanence"; + + device = mkOption { + description = "Name of the device to use for persisting data"; + type = str; + }; + + # TODO: Allow arbitrary number of categories + data = mkOption { + type = submodule peristentCategory; + default = {}; + }; + generated = mkOption { + type = submodule peristentCategory; + default = {}; + }; + }; +} From ade26e69db3964ecdcf9ad0c308d19393a1a4120 Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Sun, 3 Nov 2024 15:54:24 +0100 Subject: [PATCH 15/21] refactor(disko): cleanup --- host/LP-043/default.nix | 4 +- host/desktop/default.nix | 6 +- .../disko/btrfs-persistence-swapfile.nix | 4 +- .../features/disko/btrfs-single-partition.nix | 4 +- .../disko/device-btrfs-persistence.nix | 73 ------------------- 5 files changed, 9 insertions(+), 82 deletions(-) delete mode 100755 host/features/disko/device-btrfs-persistence.nix diff --git a/host/LP-043/default.nix b/host/LP-043/default.nix index 2d93c25..9afaeab 100755 --- a/host/LP-043/default.nix +++ b/host/LP-043/default.nix @@ -7,8 +7,8 @@ ./hardware-configuration.nix ./secrets.nix - (import ../features/disko/device-btrfs-persistence.nix { - device = "/dev/nvme0n1"; + (import ../features/disko/btrfs-persistence-swapfile.nix { + device = "nvme0n1"; swap = 38; }) diff --git a/host/desktop/default.nix b/host/desktop/default.nix index ddfed02..2a20878 100755 --- a/host/desktop/default.nix +++ b/host/desktop/default.nix @@ -7,12 +7,12 @@ ./hardware-configuration.nix ./secrets.nix - (import ../features/disko/device-btrfs-persistence.nix { - device = "/dev/nvme0n1"; + (import ../features/disko/btrfs-persistence-swapfile.nix { + device = "nvme0n1"; swap = 38; }) (import ../features/disko/btrfs-single-partition.nix { - device = "/dev/sda"; + device = "sda"; }) ../features/hyprland.nix diff --git a/host/features/disko/btrfs-persistence-swapfile.nix b/host/features/disko/btrfs-persistence-swapfile.nix index b5f9ae1..dc3dcf6 100755 --- a/host/features/disko/btrfs-persistence-swapfile.nix +++ b/host/features/disko/btrfs-persistence-swapfile.nix @@ -1,4 +1,4 @@ -# run with: sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko ./btrfs-persistence-swapfile.nix --arg device '"eg. /dev/sda"' --arg swap 'number' +# run with: sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko ./btrfs-persistence-swapfile.nix --arg device '"eg. sda"' --arg swap 'number' { device, swap ? 4, @@ -7,7 +7,7 @@ disko.devices = { disk = { main = { - inherit device; + device = "/dev/${device}"; type = "disk"; content = { type = "gpt"; diff --git a/host/features/disko/btrfs-single-partition.nix b/host/features/disko/btrfs-single-partition.nix index 13359a6..fefc46d 100755 --- a/host/features/disko/btrfs-single-partition.nix +++ b/host/features/disko/btrfs-single-partition.nix @@ -1,4 +1,4 @@ -# run with: sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko ./btrfs-single-partition.nix --arg device '"eg. /dev/sda"' +# run with: sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko ./btrfs-single-partition.nix --arg device '"eg. sda"' { device, options ? [], @@ -6,7 +6,7 @@ }: { disko.devices = { disk.single = { - inherit device; + device = "/dev/${device}"; type = "disk"; content = { type = "gpt"; diff --git a/host/features/disko/device-btrfs-persistence.nix b/host/features/disko/device-btrfs-persistence.nix deleted file mode 100755 index 31051ca..0000000 --- a/host/features/disko/device-btrfs-persistence.nix +++ /dev/null @@ -1,73 +0,0 @@ -# run with: sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko ./device-btrfs-persistence.nix --arg device '"eg. /dev/sda"' --arg swap 'number' -{ - device, - swap ? 4, - ... -}: { - disko.devices = { - disk.vdb = { - inherit device; - type = "disk"; - content = { - type = "gpt"; - partitions = { - esp = { - priority = 1; - name = "boot"; - size = "500M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - root = { - name = "root"; - size = "100%"; - content = { - type = "lvm_pv"; - vg = "root_vg"; - }; - }; - }; - }; - }; - - lvm_vg = { - root_vg = { - type = "lvm_vg"; - lvs = { - root = { - size = "100%FREE"; - content = { - type = "btrfs"; - extraArgs = ["-f"]; - - subvolumes = { - "/root" = { - mountpoint = "/"; - }; - - "/swap" = { - mountpoint = "/.swapvol"; - swap.swapfile.size = "${builtins.toString swap}G"; - }; - - "/nix" = { - mountOptions = ["subvol=nix" "compress=zstd" "noatime"]; - mountpoint = "/nix"; - }; - - "/persist" = { - mountOptions = ["subvol=persist" "compress=zstd"]; - mountpoint = "/persist"; - }; - }; - }; - }; - }; - }; - }; - }; -} From 51ad41da8515017fae9e33dab262d78facc71084 Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Wed, 13 Nov 2024 11:16:18 +0100 Subject: [PATCH 16/21] feat(eww): convert to module and fix annoyances --- flake.lock | 227 +++++++++++++----- flake.nix | 2 + home/features/eww/default.nix | 105 -------- home/features/eww/eww/dashboard.yuck | 66 ----- home/fun/default.nix | 2 +- home/nikodem/default.nix | 20 +- modules/home/default.nix | 2 + modules/home/eww/default.nix | 109 +++++++++ modules/home/eww/eww/app_list.yuck | 4 + modules/home/eww/eww/clock.yuck | 5 + .../home}/eww/eww/eww.scss | 26 +- .../home}/eww/eww/list-apps | Bin modules/home/eww/eww/music.yuck | 16 ++ modules/home/eww/eww/powermenu.yuck | 23 ++ modules/home/eww/eww/system.yuck | 27 +++ modules/home/eww/eww/volume.yuck | 9 + 16 files changed, 383 insertions(+), 260 deletions(-) delete mode 100755 home/features/eww/default.nix delete mode 100755 home/features/eww/eww/dashboard.yuck create mode 100755 modules/home/eww/default.nix create mode 100755 modules/home/eww/eww/app_list.yuck create mode 100644 modules/home/eww/eww/clock.yuck rename {home/features => modules/home}/eww/eww/eww.scss (91%) mode change 100755 => 100644 rename {home/features => modules/home}/eww/eww/list-apps (100%) create mode 100644 modules/home/eww/eww/music.yuck create mode 100644 modules/home/eww/eww/powermenu.yuck create mode 100644 modules/home/eww/eww/system.yuck create mode 100644 modules/home/eww/eww/volume.yuck diff --git a/flake.lock b/flake.lock index 8796f15..6676935 100755 --- a/flake.lock +++ b/flake.lock @@ -75,11 +75,11 @@ ] }, "locked": { - "lastModified": 1722113426, - "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", + "lastModified": 1728330715, + "narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=", "owner": "numtide", "repo": "devshell", - "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", + "rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef", "type": "github" }, "original": { @@ -108,6 +108,26 @@ "type": "github" } }, + "eww": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1728712190, + "narHash": "sha256-GxbKoS2TQNMeD4dbZn1IU+/BOiYGeVALHVAbZnFc3UU=", + "owner": "elkowar", + "repo": "eww", + "rev": "50ec181fc7ff2a68d6330e8897de2c5179575935", + "type": "github" + }, + "original": { + "owner": "elkowar", + "repo": "eww", + "type": "github" + } + }, "firefox-addons": { "inputs": { "flake-utils": "flake-utils", @@ -132,6 +152,22 @@ } }, "flake-compat": { + "locked": { + "lastModified": 1709944340, + "narHash": "sha256-xr54XK0SjczlUxRo5YwodibUSlpivS9bqHt8BNyWVQA=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "baa7aa7bd0a570b3b9edd0b8da859fee3ffaa4d4", + "type": "github" + }, + "original": { + "owner": "edolstra", + "ref": "refs/pull/65/head", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { "locked": { "lastModified": 1696426674, "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", @@ -145,7 +181,7 @@ "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" } }, - "flake-compat_2": { + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1673956053, @@ -166,11 +202,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1725234343, - "narHash": "sha256-+ebgonl3NbiKD2UD0x4BszCZQ6sTfL4xioaM49o5B3Y=", + "lastModified": 1730504689, + "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "567b938d64d4b4112ee253b9274472dc3a346eb6", + "rev": "506278e768c2a08bec68eb62932193e341f55c90", "type": "github" }, "original": { @@ -188,11 +224,11 @@ ] }, "locked": { - "lastModified": 1722555600, - "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "lastModified": 1730504689, + "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "rev": "506278e768c2a08bec68eb62932193e341f55c90", "type": "github" }, "original": { @@ -260,11 +296,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -365,11 +401,11 @@ ] }, "locked": { - "lastModified": 1724857454, - "narHash": "sha256-Qyl9Q4QMTLZnnBb/8OuQ9LSkzWjBU1T5l5zIzTxkkhk=", + "lastModified": 1730302582, + "narHash": "sha256-W1MIJpADXQCgosJZT8qBYLRuZls2KSiKdpnTVdKBuvU=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "4509ca64f1084e73bc7a721b20c669a8d4c5ebe6", + "rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf", "type": "github" }, "original": { @@ -464,11 +500,11 @@ ] }, "locked": { - "lastModified": 1724435763, - "narHash": "sha256-UNky3lJNGQtUEXT2OY8gMxejakSWPTfWKvpFkpFlAfM=", + "lastModified": 1730633670, + "narHash": "sha256-ZFJqIXpvVKvzOVFKWNRDyIyAo+GYdmEPaYi1bZB6uf0=", "owner": "nix-community", "repo": "home-manager", - "rev": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be", + "rev": "8f6ca7855d409aeebe2a582c6fd6b6a8d0bf5661", "type": "github" }, "original": { @@ -513,6 +549,36 @@ "type": "github" } }, + "ixx": { + "inputs": { + "flake-utils": [ + "neovim", + "nixvim", + "nuschtosSearch", + "flake-utils" + ], + "nixpkgs": [ + "neovim", + "nixvim", + "nuschtosSearch", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729544999, + "narHash": "sha256-YcyJLvTmN6uLEBGCvYoMLwsinblXMkoYkNLEO4WnKus=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "65c207c92befec93e22086da9456d3906a4e999c", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "ref": "v0.0.5", + "repo": "ixx", + "type": "github" + } + }, "libpng": { "flake": false, "locked": { @@ -533,15 +599,15 @@ "neovim": { "inputs": { "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixvim": "nixvim" }, "locked": { - "lastModified": 1727895893, - "narHash": "sha256-OMztpYGcaN9nxI/nJzjqUT6XqpWbOhKBUhyoNF9AEeQ=", + "lastModified": 1730981937, + "narHash": "sha256-R3V/9ujK2KTk+dYgSNYNJN0wDOVCNP6dWb4aCwmaHg4=", "owner": "NikodemMarek", "repo": "neovim", - "rev": "2cb1690198e226c65772f3d7652e2618fd971c6b", + "rev": "faa16703084dcf822671ad84fb57119963aa05b1", "type": "github" }, "original": { @@ -559,11 +625,11 @@ ] }, "locked": { - "lastModified": 1724561770, - "narHash": "sha256-zv8C9RNa86CIpyHwPIVO/k+5TfM8ZbjGwOOpTe1grls=", + "lastModified": 1730600078, + "narHash": "sha256-BoyFmE59HDF3uybBySsWVoyjNuHvz3Wv8row/mSb958=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "ac5694a0b855a981e81b4d9f14052e3ff46ca39e", + "rev": "4652874d014b82cb746173ffc64f6a70044daa7e", "type": "github" }, "original": { @@ -594,30 +660,30 @@ }, "nixpkgs": { "locked": { - "lastModified": 1725103162, - "narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=", + "lastModified": 1725534445, + "narHash": "sha256-Yd0FK9SkWy+ZPuNqUgmVPXokxDgMJoGuNpMEtkfcf84=", "owner": "nixos", "repo": "nixpkgs", - "rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b", + "rev": "9bb1e7571aadf31ddb4af77fc64b2d59580f9a39", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-unstable", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-lib": { "locked": { - "lastModified": 1725233747, - "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", + "lastModified": 1730504152, + "narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" } }, "nixpkgs-lib_2": { @@ -649,6 +715,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1730531603, + "narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1729256560, "narHash": "sha256-/uilDXvCIEs3C9l73JTACm4quuHUsIHcns1c+cHUJwA=", @@ -663,7 +745,7 @@ "type": "indirect" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1728093190, "narHash": "sha256-CAZF2NRuHmqTtRTNAruWpHA43Gg2UvuCNEIzabP0l6M=", @@ -679,7 +761,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { "lastModified": 1725194671, "narHash": "sha256-tLGCFEFTB5TaOKkpfw3iYT9dnk4awTP/q4w+ROpMfuw=", @@ -695,7 +777,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_6": { "locked": { "lastModified": 1720957393, "narHash": "sha256-oedh2RwpjEa+TNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA=", @@ -711,7 +793,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_7": { "locked": { "lastModified": 1726238386, "narHash": "sha256-3//V84fYaGVncFImitM6lSAliRdrGayZLdxWlpcuGk0=", @@ -727,7 +809,7 @@ "type": "github" } }, - "nixpkgs_7": { + "nixpkgs_8": { "locked": { "lastModified": 1727686113, "narHash": "sha256-RG+429Uv2W+X5vdZ8mAngtfC1ppzu28rCWw5R7JC3k0=", @@ -743,7 +825,7 @@ "type": "github" } }, - "nixpkgs_8": { + "nixpkgs_9": { "locked": { "lastModified": 1718428119, "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=", @@ -762,7 +844,7 @@ "nixvim": { "inputs": { "devshell": "devshell", - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "flake-parts": "flake-parts_2", "git-hooks": "git-hooks", "home-manager": "home-manager_2", @@ -775,11 +857,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1725269752, - "narHash": "sha256-AtZ9fSo2q6UeMoDy6kw6solM1B+BCABbKgCyUclsctg=", + "lastModified": 1730792264, + "narHash": "sha256-Ue3iywjyaNOxXgw7esVSBX3bZzM2bSPubZamYsBKIG8=", "owner": "nix-community", "repo": "nixvim", - "rev": "18b7597e6ca4b98a6c3f20ddc9783165d5998018", + "rev": "3d24cb72618738130e6af9c644c81fe42aa34ebc", "type": "github" }, "original": { @@ -791,6 +873,7 @@ "nuschtosSearch": { "inputs": { "flake-utils": "flake-utils_2", + "ixx": "ixx", "nixpkgs": [ "neovim", "nixvim", @@ -798,11 +881,11 @@ ] }, "locked": { - "lastModified": 1724584782, - "narHash": "sha256-7FfHv7b1jwMPSu9SPY9hdxStk8E6EeSwzqdvV69U4BM=", + "lastModified": 1730515563, + "narHash": "sha256-8lklUZRV7nwkPLF3roxzi4C2oyLydDXyAzAnDvjkOms=", "owner": "NuschtOS", "repo": "search", - "rev": "5a08d691de30b6fc28d58ce71a5e420f2694e087", + "rev": "9e22bd742480916ff5d0ab20ca2522eaa3fa061e", "type": "github" }, "original": { @@ -814,12 +897,13 @@ "root": { "inputs": { "disko": "disko", + "eww": "eww", "firefox-addons": "firefox-addons", "home-manager": "home-manager", "impermanence": "impermanence", "neovim": "neovim", "nix-ld": "nix-ld", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "sops-nix": "sops-nix", "stylix": "stylix", "systems": "systems_3", @@ -829,6 +913,27 @@ } }, "rust-overlay": { + "inputs": { + "nixpkgs": [ + "eww", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1725675754, + "narHash": "sha256-hXW3csqePOcF2e/PYnpXj72KEYyNj2HzTrVNmS/F7Ug=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "8cc45e678e914a16c8e224c3237fb07cf21e5e54", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_2": { "inputs": { "nixpkgs": [ "wezterm", @@ -849,9 +954,9 @@ "type": "github" } }, - "rust-overlay_2": { + "rust-overlay_3": { "inputs": { - "nixpkgs": "nixpkgs_8" + "nixpkgs": "nixpkgs_9" }, "locked": { "lastModified": 1727663505, @@ -869,7 +974,7 @@ }, "sops-nix": { "inputs": { - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "nixpkgs-stable": "nixpkgs-stable" }, "locked": { @@ -892,11 +997,11 @@ "base16-fish": "base16-fish", "base16-helix": "base16-helix", "base16-vim": "base16-vim", - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "flake-utils": "flake-utils_3", "gnome-shell": "gnome-shell", "home-manager": "home-manager_3", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_5", "systems": "systems_2", "tinted-foot": "tinted-foot", "tinted-kitty": "tinted-kitty", @@ -1033,11 +1138,11 @@ ] }, "locked": { - "lastModified": 1724833132, - "narHash": "sha256-F4djBvyNRAXGusJiNYInqR6zIMI3rvlp6WiKwsRISos=", + "lastModified": 1730321837, + "narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "3ffd842a5f50f435d3e603312eefa4790db46af5", + "rev": "746901bb8dba96d154b66492a29f5db0693dbfcc", "type": "github" }, "original": { @@ -1049,7 +1154,7 @@ "walker": { "inputs": { "flake-parts": "flake-parts_3", - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_6" }, "locked": { "lastModified": 1725430478, @@ -1071,8 +1176,8 @@ "freetype2": "freetype2", "harfbuzz": "harfbuzz", "libpng": "libpng", - "nixpkgs": "nixpkgs_6", - "rust-overlay": "rust-overlay", + "nixpkgs": "nixpkgs_7", + "rust-overlay": "rust-overlay_2", "zlib": "zlib" }, "locked": { @@ -1095,8 +1200,8 @@ "wired": { "inputs": { "flake-parts": "flake-parts_4", - "nixpkgs": "nixpkgs_7", - "rust-overlay": "rust-overlay_2" + "nixpkgs": "nixpkgs_8", + "rust-overlay": "rust-overlay_3" }, "locked": { "lastModified": 1727849733, diff --git a/flake.nix b/flake.nix index 1839ff5..0bfc7e5 100755 --- a/flake.nix +++ b/flake.nix @@ -26,6 +26,8 @@ walker.url = "github:abenz1267/walker"; + eww.url = "github:elkowar/eww"; + firefox-addons = { url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/home/features/eww/default.nix b/home/features/eww/default.nix deleted file mode 100755 index 65b2c45..0000000 --- a/home/features/eww/default.nix +++ /dev/null @@ -1,105 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: let - cfg = config.wm.eww; - - inherit (lib) types elemAt; - - primaryMonitor = elemAt config.settings.monitors 0; - grid = { - width = primaryMonitor.width / 16; - height = primaryMonitor.height / 9; - }; - - run = lib.writeShellScript "eww" '' - ${pkgs.eww}/bin/eww daemon - - ${lib.concelemAtStrings (builtins.map (win: '' - ${pkgs.eww}/bin/eww open ${elemAt win 0} - '') - cfg.windows)} - ''; -in { - options.wm.eww = { - enable = lib.mkEnableOption "Enable eww"; - - border = lib.mkOption { - type = types.int; - default = 10; - description = "The border around the widgets."; - }; - - windows = lib.mkOption { - type = types.listOf (types.listOf (types.either types.toString types.int)); - default = [ - # widget x y width height - ["powermenu" 12 0 4 2] - ["system" 0 2 4 3] - ["time" 4 2 8 5] - ["music" 0 5 4 2] - ["shortcuts" 0 0 4 2] - ["volume" 4 0 4 2] - ["app_list" 12 2 4 7] - ]; - description = "The widgets to display."; - }; - }; - - config = lib.mkIf cfg.enable { - home.packages = with pkgs; [ - eww - playerctl - ]; - - xdg.configFile = { - eww = { - source = ./eww; - recursive = true; - }; - "eww/device_specific.yuck".text = '' - ; system - (defwidget system [] - (box :class "system dashboard_window" :vexpand false :hexpand false - (box :orientelemAtion "h" :spacing 35 :halign "center" :valign "center" :space-evenly false :vexpand false :hexpand false - (box :class "system_cpu_bar" :orientelemAtion "v" :spacing 20 :space-evenly false :vexpand false :hexpand false - (progress :value { EWW_CPU.avg } :orientelemAtion "v" :flipped true) - (label :class "system_iconcpu" :text "")) - (box :class "system_mem_bar" :orientelemAtion "v" :spacing 20 :space-evenly false :vexpand false :hexpand false - (progress :value { EWW_RAM.used_mem_perc } :orientelemAtion "v" :flipped true) - (label :class "system_iconmem" :text "")) - (box :class "system_drive_bar" :orientelemAtion "v" :spacing 20 :space-evenly false :vexpand false :hexpand false - (progress :value { EWW_DISK["/home"].used_perc } :orientelemAtion "v" :flipped true) - (label :class "system_icondrive" :text "󰋊")) - ${ - if cfg.device == "laptop" - then '' - (box :class "system_belemAt_bar" :orientelemAtion "v" :spacing 20 :space-evenly false :vexpand false :hexpand false - (progress :value { EWW_BATTERY.total_avg } :orientelemAtion "v" :flipped true) - (label :class "system_iconbelemAt" :text "󰁹")) - '' - else "" - }))) - - ; shortcuts - (defwidget shortcuts [] - (box :class "shortcuts dashboard_window" :orientelemAtion "v" :space-evenly false - ${builtins.concelemAtStringsSep "\n\t" (builtins.map (row: "(box :vexpand true :hexpand true\n${builtins.concelemAtStringsSep "\n" (builtins.map (item: "\t\t(button :class \"shortcuts_button\" :onclick \"${elemAt item 0} &\" \"${elemAt item 1}\")") row)})") cfg.shortcuts)})) - ''; - "eww/eww.yuck".text = '' - (include "./dashboard.yuck") - (include "./device_specific.yuck") - - ; windows - ${builtins.concelemAtStringsSep "\n" (builtins.map (win: '' - (defwindow ${elemAt win 0} :stacking "bottom" :focusable true :exclusive false :monitor 0 - :geometry (geometry :x ${toString (grid.width * elemAt win 1 + cfg.border)} :y ${toString (grid.height * elemAt win 2 + cfg.border)} :width ${toString (grid.width * elemAt win 3 - cfg.border * 2)} :height ${toString (grid.height * elemAt win 4 - cfg.border * 2)}) - (${elemAt win 0})) - '') - cfg.windows)} - ''; - }; - }; -} diff --git a/home/features/eww/eww/dashboard.yuck b/home/features/eww/eww/dashboard.yuck deleted file mode 100755 index 6c475d2..0000000 --- a/home/features/eww/eww/dashboard.yuck +++ /dev/null @@ -1,66 +0,0 @@ -; powermenu -(defwidget powermenu_poweroff [] - (button :class "powermenu_button powermenu_poweroff" :onclick "systemctl poweroff" "")) -(defwidget powermenu_reboot [] - (button :class "powermenu_button powermenu_reboot" :onclick "systemctl reboot" "")) -(defwidget powermenu_lock [] - (button :class "powermenu_button powermenu_lock" :onclick "hyprlock" "")) -(defwidget powermenu_logout [] - (button :class "powermenu_button powermenu_logout" :onclick "hyprctl dispatch exit" "")) -(defwidget powermenu_sleep [] - (button :class "powermenu_button powermenu_sleep" :onclick "hyprlock ; systemctl suspend ; eww reload" "")) -(defwidget powermenu_hibernate [] - (button :class "powermenu_button powermenu_hibernate" :onclick "hyprlock ; systemctl hibernate ; eww reload" "")) - -(defwidget powermenu [] - (box :class "powermenu dashboard_window" :orientation "v" :space-evenly false - (box :vexpand true :hexpand true - (powermenu_poweroff) - (powermenu_lock) - (powermenu_sleep)) - (box :vexpand true :hexpand true - (powermenu_reboot) - (powermenu_logout) - (powermenu_hibernate)))) - -; clock -(defwidget time [] - (box :class "clock dashboard_window" :orientation "v" :vexpand true :hexpand true - (box :class "" :orientation "v" :spacing 20 :space-evenly false :valign "center" :halign "center" - (label :class "time" :text { formattime(EWW_TIME, "%H %M %S") }) - (label :class "date" :text { formattime(EWW_TIME, "%a, %b %e") })))) - -; music -(deflisten music_status :initial "err" `playerctl -F status`) -(deflisten music_song :initial "title unknown" `playerctl -F metadata xesam:title`) -(deflisten music_artist :initial "artist unknown" `playerctl -F metadata xesam:artist`) -(deflisten music_cover :initial "" `playerctl -F metadata mpris:artUrl`) - -(defwidget music [] - (box :class "music dashboard_window" :orientation "h" :space-evenly true :vexpand false :hexpand false - (box :class "music_cover" :vexpand true :hexpand true :style "background-image: url('${music_cover}');") - (box :orientation "v" :valign "center" :spacing 30 :space-evenly false :vexpand true :hexpand false - (label :halign "center" :class "song" :wrap true :limit-width 20 :text music_song) - (label :halign "center" :class "artist" :wrap true :limit-width 15 :text music_artist) - (box :orientation "h" :spacing 20 :halign "center" :space-evenly true :vexpand false :hexpand false - (button :class "music_play_random" :onclick "beet play -y &" "") - (button :class "music_prev" :onclick "playerctl previous" "󰒮") - (button :class "music_status" :onclick "playerctl play-pause" { music_status == "Playing"? "": "" }) - (button :class "music_next" :onclick "playerctl next" "󰒭"))))) - -; volume -(defpoll volume_level :interval "1s" `wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $2 * 100}'`) -(defpoll volume_muted :interval "1s" `wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $3 == "[MUTED]"}'`) - -(defwidget volume [] - (box :class "volume dashboard_window" :orientation "v" :space-evenly true - (box :class "" :orientation "h" - (button :class "volume_button" :onclick "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" { volume_muted == "1"? "": "" }) - (label :class "volume_level" :text volume_level)) - (scale :min 0 :max 101 :value volume_level :orientation "h" :flipped false :active true :onchange "wpctl set-volume @DEFAULT_AUDIO_SINK@ {}%"))) - -; app list -(deflisten app_list_apps :initial "empty" `./list-apps`) - -(defwidget app_list [] - (literal :class "dashboard_window app_list" :content app_list_apps)) diff --git a/home/fun/default.nix b/home/fun/default.nix index 3d98b6c..d71f032 100755 --- a/home/fun/default.nix +++ b/home/fun/default.nix @@ -16,7 +16,7 @@ services = {} - // lib.mkIf (host-config.networking.hostName == "laptop") { + // lib.optionalAttrs (host-config.networking.hostName == "laptop") { battery-notifier = { enable = true; capacityPath = "/sys/class/power_supply/BAT1/capacity"; diff --git a/home/nikodem/default.nix b/home/nikodem/default.nix index d03ad43..fb17d3a 100755 --- a/home/nikodem/default.nix +++ b/home/nikodem/default.nix @@ -20,8 +20,24 @@ ]; services = - {} - // lib.mkIf (host-config.networking.hostName == "laptop") { + { + eww = { + enable = true; + windows = { + powermenu.grid = [12 0 4 2]; + system = { + grid = [0 2 4 3]; + args = { + battery = "true"; + }; + }; + clock.grid = [4 2 8 5]; + music.grid = [0 5 4 2]; + volume.grid = [4 0 4 2]; + }; + }; + } + // lib.optionalAttrs (host-config.networking.hostName == "laptop") { battery-notifier = { enable = true; capacityPath = "/sys/class/power_supply/BAT1/capacity"; diff --git a/modules/home/default.nix b/modules/home/default.nix index 362090e..d7a3cf8 100755 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -2,4 +2,6 @@ battery-notifier = import ./battery-notifier.nix; persist = import ./persist.nix; openfortivpn = import ./openfortivpn.nix; + + eww = import ./eww; } diff --git a/modules/home/eww/default.nix b/modules/home/eww/default.nix new file mode 100755 index 0000000..12c9ec4 --- /dev/null +++ b/modules/home/eww/default.nix @@ -0,0 +1,109 @@ +{ + inputs, + pkgs, + lib, + config, + ... +}: { + options.services.eww = let + inherit (lib) mkOption mkEnableOption; + inherit (lib.types) listOf attrs attrsOf int submodule; + + window.options = { + grid = mkOption { + type = listOf int; + }; + args = mkOption { + type = attrs; + default = {}; + }; + }; + in { + enable = mkEnableOption "Enable eww"; + + border = mkOption { + type = int; + default = 10; + description = "The border around the widgets."; + }; + + windows = mkOption { + type = attrsOf (submodule window); + default = { + powermenu.grid = [12 0 4 2]; + system = { + grid = [0 2 4 3]; + args = { + battery = "true"; + }; + }; + clock.grid = [4 2 8 5]; + music.grid = [0 5 4 2]; + volume.grid = [4 0 4 2]; + app_list.grid = [12 2 4 7]; + }; + }; + }; + + config = let + cfg = config.services.eww; + + inherit (lib) mkIf getExe elemAt attrsToList; + inherit (builtins) map concatStringsSep; + + eww = inputs.eww.packages.${pkgs.system}.default; + in + mkIf cfg.enable { + home.packages = [ + eww + + pkgs.playerctl + pkgs.wireplumber + ]; + + xdg.configFile = { + eww = { + source = ./eww; + recursive = true; + }; + "eww/eww.yuck".text = let + inherit (cfg) border; + + cell = { + width = 1920 / 16; + height = 1080 / 9; + }; + + genIncludes = windows: concatStringsSep "\n" (map (win: ''(include "./${win.name}.yuck")'') (attrsToList windows)); + genGeometry = coords: ''(geometry :x ${toString (cell.width * elemAt coords 0 + border)} :y ${toString (cell.height * elemAt coords 1 + border)} :width ${toString (cell.width * elemAt coords 2 - border * 2)} :height ${toString (cell.height * elemAt coords 3 - border * 2)})''; + genParams = args: concatStringsSep " " (map (param: ''${param.name}'') (attrsToList args)); + genArgs = args: concatStringsSep " " (map (arg: '':${arg.name} ${toString arg.name}'') (attrsToList args)); + genWindows = windows: concatStringsSep "\n" (map (win: ''(defwindow ${win.name} [${genParams win.value.args}] :stacking "bottom" :focusable false :exclusive false :monitor 0 :geometry ${genGeometry win.value.grid} (${win.name} ${genArgs win.value.args}))'') (attrsToList windows)); + in '' + ${genIncludes cfg.windows} + + ${genWindows cfg.windows} + ''; + }; + + systemd.user.services.eww = { + Install = { + WantedBy = ["graphical-session.target"]; + }; + Service = { + Type = "forking"; + ExecStart = let + ewwExe = getExe eww; + + genArgs = args: concatStringsSep " " (map (arg: ''--arg ${arg.name}=${toString arg.value}'') (attrsToList args)); + genWindows = windows: concatStringsSep "\n" (map (win: ''${ewwExe} open ${win.name} ${genArgs win.value.args}'') (attrsToList windows)); + in + getExe (pkgs.writeShellScriptBin "eww-execstart" '' + ${ewwExe} daemon --force-wayland + + ${genWindows cfg.windows} + ''); + }; + }; + }; +} diff --git a/modules/home/eww/eww/app_list.yuck b/modules/home/eww/eww/app_list.yuck new file mode 100755 index 0000000..a17abdc --- /dev/null +++ b/modules/home/eww/eww/app_list.yuck @@ -0,0 +1,4 @@ +(deflisten app_list_apps :initial "empty" `./list-apps`) + +(defwidget app_list [] + (literal :class "dashboard_window app_list" :content app_list_apps)) diff --git a/modules/home/eww/eww/clock.yuck b/modules/home/eww/eww/clock.yuck new file mode 100644 index 0000000..9db9a69 --- /dev/null +++ b/modules/home/eww/eww/clock.yuck @@ -0,0 +1,5 @@ +(defwidget clock [] + (box :class "clock dashboard_window" :orientation "v" :vexpand true :hexpand true + (box :class "" :orientation "v" :spacing 20 :space-evenly false :valign "center" :halign "center" + (label :class "time" :text { formattime(EWW_TIME, "%H %M %S") }) + (label :class "date" :text { formattime(EWW_TIME, "%a, %b %e") })))) diff --git a/home/features/eww/eww/eww.scss b/modules/home/eww/eww/eww.scss old mode 100755 new mode 100644 similarity index 91% rename from home/features/eww/eww/eww.scss rename to modules/home/eww/eww/eww.scss index 0f69c14..dd2f49d --- a/home/features/eww/eww/eww.scss +++ b/modules/home/eww/eww/eww.scss @@ -72,7 +72,7 @@ scale slider { .system { background-color: $mantle; border-radius: 8px; - + margin: 5px; padding: 5px; } @@ -190,30 +190,6 @@ scale slider { color: $mauve; } -/** shortcuts ***********************************/ -.shortcuts { - background-color: $mantle; - border-radius: 8px; - margin: 5px; - padding: 5px; -} - -.shortcuts_button { - font-size: 32px; - margin: 10px; - padding: 5px; - border-radius: 8px; - background: none; - border: 2px solid transparent; - outline: none; - box-shadow: none; -} - -.shortcuts_button:hover { - border: 2px solid $mauve; - color: $mauve; -} - /** volume **************************************/ .volume { background-color: $mantle; diff --git a/home/features/eww/eww/list-apps b/modules/home/eww/eww/list-apps similarity index 100% rename from home/features/eww/eww/list-apps rename to modules/home/eww/eww/list-apps diff --git a/modules/home/eww/eww/music.yuck b/modules/home/eww/eww/music.yuck new file mode 100644 index 0000000..d6b02fc --- /dev/null +++ b/modules/home/eww/eww/music.yuck @@ -0,0 +1,16 @@ +(deflisten music_status :initial "err" `playerctl -F status`) +(deflisten music_song :initial "title unknown" `playerctl -F metadata xesam:title`) +(deflisten music_artist :initial "artist unknown" `playerctl -F metadata xesam:artist`) +(deflisten music_cover :initial "" `playerctl -F metadata mpris:artUrl`) + +(defwidget music [] + (box :class "music dashboard_window" :orientation "h" :space-evenly true :vexpand false :hexpand false + (box :class "music_cover" :vexpand true :hexpand true :style "background-image: url('${music_cover}');") + (box :orientation "v" :valign "center" :spacing 30 :space-evenly false :vexpand true :hexpand false + (label :halign "center" :class "song" :wrap true :limit-width 20 :text music_song) + (label :halign "center" :class "artist" :wrap true :limit-width 15 :text music_artist) + (box :orientation "h" :spacing 20 :halign "center" :space-evenly true :vexpand false :hexpand false + (button :class "music_play_random" :onclick "beet play -y &" "") + (button :class "music_prev" :onclick "playerctl previous" "󰒮") + (button :class "music_status" :onclick "playerctl play-pause" { music_status == "Playing"? "": "" }) + (button :class "music_next" :onclick "playerctl next" "󰒭"))))) diff --git a/modules/home/eww/eww/powermenu.yuck b/modules/home/eww/eww/powermenu.yuck new file mode 100644 index 0000000..aea5a8e --- /dev/null +++ b/modules/home/eww/eww/powermenu.yuck @@ -0,0 +1,23 @@ +(defwidget powermenu_poweroff [] + (button :class "powermenu_button powermenu_poweroff" :onclick "systemctl poweroff" "")) +(defwidget powermenu_reboot [] + (button :class "powermenu_button powermenu_reboot" :onclick "systemctl reboot" "")) +(defwidget powermenu_lock [] + (button :class "powermenu_button powermenu_lock" :onclick "hyprlock" "")) +(defwidget powermenu_logout [] + (button :class "powermenu_button powermenu_logout" :onclick "hyprctl dispatch exit" "")) +(defwidget powermenu_sleep [] + (button :class "powermenu_button powermenu_sleep" :onclick "hyprlock ; systemctl suspend ; eww reload" "")) +(defwidget powermenu_hibernate [] + (button :class "powermenu_button powermenu_hibernate" :onclick "hyprlock ; systemctl hibernate ; eww reload" "")) + +(defwidget powermenu [] + (box :class "powermenu dashboard_window" :orientation "v" :space-evenly false + (box :vexpand true :hexpand true + (powermenu_poweroff) + (powermenu_lock) + (powermenu_sleep)) + (box :vexpand true :hexpand true + (powermenu_reboot) + (powermenu_logout) + (powermenu_hibernate)))) diff --git a/modules/home/eww/eww/system.yuck b/modules/home/eww/eww/system.yuck new file mode 100644 index 0000000..8da89b8 --- /dev/null +++ b/modules/home/eww/eww/system.yuck @@ -0,0 +1,27 @@ +(defwidget system_cpu [] + (box :class "system_cpu_bar" :orientation "v" :spacing 20 :space-evenly false :vexpand false :hexpand false + (progress :value { EWW_CPU.avg } :orientation "v" :flipped true) + (label :class "system_iconcpu" :text ""))) + +(defwidget system_mem [] + (box :class "system_mem_bar" :orientation "v" :spacing 20 :space-evenly false :vexpand false :hexpand false + (progress :value { EWW_RAM.used_mem_perc } :orientation "v" :flipped true) + (label :class "system_iconmem" :text ""))) + +(defwidget system_drive [] + (box :class "system_drive_bar" :orientation "v" :spacing 20 :space-evenly false :vexpand false :hexpand false + (progress :value { EWW_DISK["/persist"].used_perc } :orientation "v" :flipped true) + (label :class "system_icondrive" :text "󰋊"))) + +(defwidget system_battery [visible] + (box :class "system_bat_bar" :orientation "v" :spacing 20 :space-evenly false :vexpand false :hexpand false :visible visible + (progress :value { EWW_BATTERY["BAT1"].capacity } :orientation "v" :flipped true) + (label :class "system_iconbat" :text "󰁹"))) + +(defwidget system [battery] + (box :class "system dashboard_window" :vexpand false :hexpand false + (box :orientation "h" :spacing 35 :halign "center" :valign "center" :space-evenly false :vexpand false :hexpand false + (system_cpu) + (system_mem) + (system_drive) + (system_battery :visible battery)))) diff --git a/modules/home/eww/eww/volume.yuck b/modules/home/eww/eww/volume.yuck new file mode 100644 index 0000000..f15a7b5 --- /dev/null +++ b/modules/home/eww/eww/volume.yuck @@ -0,0 +1,9 @@ +(defpoll volume_level :initial "100" :interval "1s" `wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $2 * 100}'`) +(defpoll volume_muted :initial "0" :interval "1s" `wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $3 == "[MUTED]"}'`) + +(defwidget volume [] + (box :class "volume dashboard_window" :orientation "v" :space-evenly true + (box :class "" :orientation "h" + (button :class "volume_button" :onclick "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" { volume_muted == "1"? "": "" }) + (label :class "volume_level" :text volume_level)) + (scale :min 0 :max 101 :value volume_level :orientation "h" :flipped false :active true :onchange "wpctl set-volume @DEFAULT_AUDIO_SINK@ {}%"))) From 703cdc1a154f365f41aa44a1e86b3fc3c48c1713 Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Fri, 15 Nov 2024 20:13:04 +0100 Subject: [PATCH 17/21] refactor(fabric-ai): remove fabric-ai because it is in nixpkgs --- pkgs/default.nix | 1 - pkgs/fabric-ai.nix | 34 ---------------------------------- 2 files changed, 35 deletions(-) delete mode 100755 pkgs/fabric-ai.nix diff --git a/pkgs/default.nix b/pkgs/default.nix index c7ba517..9f261a4 100755 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,4 +1,3 @@ {pkgs ? (import ../nixpkgs.nix) {}}: { anysync = pkgs.callPackage ./anysync.nix {}; - fabric-ai = pkgs.callPackage ./fabric-ai.nix {}; } diff --git a/pkgs/fabric-ai.nix b/pkgs/fabric-ai.nix deleted file mode 100755 index d4954bb..0000000 --- a/pkgs/fabric-ai.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ - lib, - buildGo123Module, - fetchFromGitHub, - nix-update-script, -}: -buildGo123Module { - pname = "fabric-ai"; - version = "2.0.0"; - - src = fetchFromGitHub { - owner = "danielmiessler"; - repo = "fabric"; - rev = "9b8871f25b17dfeb7338ebaf39078bb0929b0fb9"; - hash = "sha256-tgcX+ljottUU+oRqH4m5coiZBn7/2cV03/2yEEG5Nlk="; - }; - - vendorHash = "sha256-CHgeHumWtNt8SrbzzCWqBdLxTmmyDD2bfLkriPeez2E="; - - ldflags = [ - "-s" - "-w" - ]; - - passthru.updateScript = nix-update-script {}; - - meta = { - description = "Fabric is an open-source framework for augmenting humans using AI. It provides a modular framework for solving specific problems using a crowdsourced set of AI prompts that can be used anywhere"; - homepage = "https://github.com/danielmiessler/fabric"; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [jaredmontoya]; - mainProgram = "fabric"; - }; -} From c42e21dc6252f7a7ff447dec0ba94fd1da0fe9b2 Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Sat, 30 Nov 2024 14:14:28 +0100 Subject: [PATCH 18/21] fix(syncthing): it still does not work, but its trying --- host/desktop/default.nix | 59 +++++++++++++++------------------- host/laptop/default.nix | 33 +++++++++++++++++++ host/laptop/syncthing_cert.pem | 28 ++++++++++++++++ host/laptop/syncthing_key.pem | 28 ++++++++++++++++ 4 files changed, 115 insertions(+), 33 deletions(-) create mode 100644 host/laptop/syncthing_cert.pem create mode 100644 host/laptop/syncthing_key.pem diff --git a/host/desktop/default.nix b/host/desktop/default.nix index 2a20878..e38e9d6 100755 --- a/host/desktop/default.nix +++ b/host/desktop/default.nix @@ -62,39 +62,32 @@ linuxKernel.packages.linux_6_1.rtl8821au ]; - services = { - music = { - enable = true; - anysync = true; - persistent = true; - }; - # TODO: Migrate to home-manager when it gets support - syncthing = { - enable = true; - openDefaultPorts = false; - key = config.sops.secrets."syncthing/key".path; - cert = config.sops.secrets."syncthing/cert".path; - overrideDevices = true; - overrideFolders = true; - user = "nikodem"; - group = "users"; - dataDir = "${config.users.users.nikodem.home}/.local/share/syncthing"; - configDir = "${config.users.users.nikodem.home}/.config/syncthing"; - settings = { - devices = { - "pixel-6a".id = "L7IXLIC-DU3D4MJ-OVOXKBW-D5M2AW5-3JWOFF4-X43JUPT-JN3XWZL-2FNL6QT"; - "tablet".id = "SCFNK0Z-UDF56C2-26ZS36D-A2PNTWO-K06IC55-0QGWCTN-MLNQBND-PXD8JQX"; - }; - folders = { - "obsidian" = { - path = "${config.users.users.nikodem.home}/vaults/main"; - devices = ["pixel-6a" "tablet"]; - copyOwnershipFromParent = true; - versioning = { - type = "simple"; - params = { - keep = "5"; - }; + # TODO: Migrate to home-manager when it gets support + services.syncthing = { + enable = true; + openDefaultPorts = false; + key = config.sops.secrets."syncthing/key".path; + cert = config.sops.secrets."syncthing/cert".path; + overrideDevices = true; + overrideFolders = true; + user = "nikodem"; + group = "users"; + dataDir = "${config.users.users.nikodem.home}/.local/share/syncthing"; + configDir = "${config.users.users.nikodem.home}/.config/syncthing"; + settings = { + devices = { + "pixel-6a".id = "L7IXLIC-DU3D4MJ-OVOXKBW-D5M2AW5-3JWOFF4-X43JUPT-JN3XWZL-2FNL6QT"; + "tablet".id = "SCFNK0Z-UDF56C2-26ZS36D-A2PNTWO-K06IC55-0QGWCTN-MLNQBND-PXD8JQX"; + }; + folders = { + "obsidian" = { + path = "${config.users.users.nikodem.home}/vaults/main"; + devices = ["pixel-6a" "tablet"]; + copyOwnershipFromParent = true; + versioning = { + type = "simple"; + params = { + keep = "5"; }; }; }; diff --git a/host/laptop/default.nix b/host/laptop/default.nix index 8a78cb5..61c4a1b 100755 --- a/host/laptop/default.nix +++ b/host/laptop/default.nix @@ -15,6 +15,7 @@ ../features/hyprland.nix ../features/docker.nix ../features/dnscrypt-proxy2.nix + ../features/syncthing.nix ../features/battery-saver.nix ../features/bluetooth.nix @@ -46,4 +47,36 @@ shell = pkgs.fish; }; }; + + services.syncthing = { + enable = true; + openDefaultPorts = false; + key = config.sops.secrets."syncthing/key".path; + cert = config.sops.secrets."syncthing/cert".path; + overrideDevices = true; + overrideFolders = true; + user = "nikodem"; + group = "users"; + dataDir = "${config.users.users.nikodem.home}/.local/share/syncthing"; + configDir = "${config.users.users.nikodem.home}/.config/syncthing"; + settings = { + devices = { + "pixel-6a".id = "L7IXLIC-DU3D4MJ-OVOXKBW-D5M2AW5-3JWOFF4-X43JUPT-JN3XWZL-2FNL6QT"; + "tablet".id = "SCFNK0Z-UDF56C2-26ZS36D-A2PNTWO-K06IC55-0QGWCTN-MLNQBND-PXD8JQX"; + }; + folders = { + "obsidian" = { + path = "${config.users.users.nikodem.home}/vaults/main"; + devices = ["pixel-6a" "tablet"]; + copyOwnershipFromParent = true; + versioning = { + type = "simple"; + params = { + keep = "5"; + }; + }; + }; + }; + }; + }; } diff --git a/host/laptop/syncthing_cert.pem b/host/laptop/syncthing_cert.pem new file mode 100644 index 0000000..a05b91e --- /dev/null +++ b/host/laptop/syncthing_cert.pem @@ -0,0 +1,28 @@ +{ + "data": "ENC[AES256_GCM,data:fmoq/cI0YCJMb+n+FznLw/uKzi7CGJHHAXl2gdO7alWHzNwqIXKD4yYzTR/B2uBCsxH3TNUMPl5S46fMief4zE8D+166gyC5pWlaccF4c8DyWnZScZZVLLBcns4W2KAseCDWl0RBdXl1a5XK68tqRcqqdLYH4gTaxRqaz01SQD4p5y0tZVLTt1WIybxV6otjBP3xpKbDf5KdIy78MbjYTyV+2tgyaHevJYTXNkSVGoC7Pd9Y7JjsxLjs+eBYxQ2UcuIUqjbfKOtIHqSxY3sGcR1ucMJ+2V5YcKyAnRf6jh5KlCU/DV/s+NYpTZodhi9q2ukxjZRptEItr78K68Qdq7zisvftJDy3ExcCNt7QOsz9u+AreUPgEmZQQESMfF1B1qkpJfgECrUiTfFXVuWYKLRqgqZHJXafyTJiMjZ3EjoLXaXaT8WXHPhrOMjf7cVhqin4M1+NMW8IkScqHypGgOeeo+plao3OC2KEoJYbdctJqbnbkLTVDmBw39CILFD5+y/T66vjQUL6VINduNx+vFIIdnhiODxyakoDHyEy5BGp/xiQdUH+Nde0xOWqhx8DMlVXWymdTXkMd6NzflRub0yaitKDWKhCz8lPHTIibkwvhTzA6cHganp6gOzgZ816g+c7WloTl9VObIbRFtycZyhkgWbb6iyhQ8lSFzT9nLurCmDaDoCqtrOX/JMUYCZq1Fs/FN0j4mVY35zcYPoGZODBWs6YeEgcnNA3RublHQZro9WGIUgVjFZlzEVzukw4M557KK/L3CG0MxlDrGCappsLnbfZwui37ZXGELxI2TOGVJIK9Dik0Slk5yYHuP6DJtb5+viO4MUN6bZIDIZn/knUQ4HmpaWoyopf/N//l2GbtLUDV/+EObiM2AktPEvDi6K1Mwi2LwgAn8Kg86TruxAdo4d77tjh1PI36ki+oNLFODOXl5CKKXx7X1tFdcjdExTkX9xn/LaNgW5+b4/HFGMwJQlyUp7DPmEiRlzrlo7MXzzDHVAZo0SAU6Xe1nitA1CBy0H4r0zTYZtHPkmRrTAzkQNmhoVPgMM=,iv:vco4EwzNfFbNXfgUk5Yn9QjP7fSqLo8aajWIa6k9AxU=,tag:DmkUnGXKa0JZedhsdf9Hsw==,type:str]", + "sops": { + "kms": null, + "gcp_kms": null, + "azure_kv": null, + "hc_vault": null, + "age": [ + { + "recipient": "age12ud73504ccl26mrrqncsj204cyv0k2y7tepc64qerqts8xywja0qrn8uwq", + "enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBCanZXQ3NrMWhMc0RiV0hD\nOGRoUEhoSFY3c21oNWZIOWRtTWFDS256TndBClhtTGFwa2dVUFlocVhsaGY5WmZy\neUl3QXA1WGNwZVZKN2YzMHdYL2xOOUUKLS0tIHRMNVBrS3pIKzJqdjF6NE42NUgv\nQ1VETVE2YlpWblRYa2NGdU1vTDFuVTgKJ8yoXEoEypGn8tHAyNInqaZjKXdh+1s+\niMOLsJYMeVnrgXCOQDG4phuJMqz8Qd8lgAnxMtyEluEhQDb8tgwKqQ==\n-----END AGE ENCRYPTED FILE-----\n" + }, + { + "recipient": "age1hl0hkstkuu292skpuxc0kh49sm9lajg4ugns8zez000hdgfs0ausmv326a", + "enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAwaWdoYjg4c2o3c2taczhW\nUGJuZmhQWVN5S1JwSHEwL09Md3NpaWkyM0M0Cjl6U2xBeWdEV1J6M0VQMTIzOGQ2\nbm5pcG9BUnJzMTR5ODBUT3ZVMUhjWVEKLS0tIDYxK01QUnVXc2lQWENsd1NYeHdM\nbnl2N0Q2QzR1K0VFeFozNi9BNGZiWkUKlLqzsNCVEsRdc5FE21eL1O9VSub5kQxl\nbtHRD9b2e8jIWOmHNdO71Vj4FC9m0oTwtxEcID47qL5AHQvAFU1ADQ==\n-----END AGE ENCRYPTED FILE-----\n" + }, + { + "recipient": "age13nrwdpkx23up6dre09mv5lh9lv3xynqf96sn3qlgykjmu6dzk44shvlh9n", + "enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBnZTNCM2J5NEVRRHNuK0pz\nS0NmZG1mRzhXN0U2QlUxeGZJY003RmlTYVhNCkRhems3cS9TWGQxc0RtaUJaQ2s4\nS3piQ0pjWXV1dmhuYnAzMTIvYzlaYjgKLS0tIFdTdURhekE4Mmxyc3g1cnBHSk9H\nNzRYakpuZE54Q2ptNkU4ZlVBaCswalkKMvrZ2jNa/EBcuZmVjXFisZeFkM0i/IHw\nYVj/lMDDfusw9l3xqmBy18oRoJywp/Wi7CIUrVT7Gc7I4zIYBLiyxQ==\n-----END AGE ENCRYPTED FILE-----\n" + } + ], + "lastmodified": "2024-11-15T18:44:17Z", + "mac": "ENC[AES256_GCM,data:DCAyndTUN2Ky94p+I28GH7kk3CWCit3nrf5XGzRMkPRnE3A6dC4yTdXpAQiVyAOqyjbDt5ExzyBigwAEORI1QRGdylp2naD7PA52BencNLAAowXHqS91IAPoTOHz8v9bMU/jQqQBYG9zGVu5vq2EBaI4cD0qOfqvN9Mki/fuoHQ=,iv:60/p1rpVmwb0X28fGKdDNbXyLl1bvwqYqXh4YN1f+YQ=,tag:NENTJvnd+UPkm/P4D2xvIA==,type:str]", + "pgp": null, + "unencrypted_suffix": "_unencrypted", + "version": "3.9.1" + } +} \ No newline at end of file diff --git a/host/laptop/syncthing_key.pem b/host/laptop/syncthing_key.pem new file mode 100644 index 0000000..4c72dfc --- /dev/null +++ b/host/laptop/syncthing_key.pem @@ -0,0 +1,28 @@ +{ + "data": "ENC[AES256_GCM,data:z51L7fqXxXUtdBB8HHhnJCktOjqOeeLEJ0sExGDJF8mPROf5b7vdQzD0qW4gIhsdc9NBa8pGcpn4MD0vJIai3e2T844qZR4sl3AsdEPYYZCjVBgfne7b4fX7wNhwdWh0ypR0CWiOjoEHKCOKb2ZLAMKpkJYu8b9OoV6fhKz0+GbArWdFIPEymBtMvM4cE9VzGWyH0YEot/ASRFs5bm9ghB+mesKff31dePJvNdjEQymuEfa9GY1zVK9jE6XI68KQn0OpahaUYkJGYqntUhecxvaUhs0qtPyolSN4IHYSTSW1L5y7ovTJh9sx/JmO7+2v0Gizk3Hsw0FOO431KKieHEFGebw/DdVc1ZbkH1KiFk5ghIWyJikUOoWd8pRajqog,iv:cqsF7oOyFCzduDY6fxSp8wOBTGqHzL8tlgZ06NfbaPI=,tag:EQnu6VJ/xu97XOqC4E9uzw==,type:str]", + "sops": { + "kms": null, + "gcp_kms": null, + "azure_kv": null, + "hc_vault": null, + "age": [ + { + "recipient": "age12ud73504ccl26mrrqncsj204cyv0k2y7tepc64qerqts8xywja0qrn8uwq", + "enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBMamVQK2FNa1g1cVl5a1RJ\nZnZnSWY5WmRoOC9aNitrRE8remE2RktzT0FvClN3QjhoNS9haUpDSXlTU3hENXBS\nQlJLMXB4N3pPeEZaelljZVRDTzcrenMKLS0tIDh5VjJmLzd5b2R6cHMrbHJ4L2tl\nTjRHd0hDZHByWkp1MzUvK3NQT2szZ1kKFn6cNEUUukT4LBXKrKz4OUnVI5TPEe/0\n2QQnNpD+N2f4gR715yzcuUSmYevgvPyVL6siI51sy4gAzSB14pSZQA==\n-----END AGE ENCRYPTED FILE-----\n" + }, + { + "recipient": "age1hl0hkstkuu292skpuxc0kh49sm9lajg4ugns8zez000hdgfs0ausmv326a", + "enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBxc0ozaXlNSnJhZnhNZkx3\nc0FReUdRMGRxcVROcHhnS2xmVTVyeS9uRGg4Cm9COCsyclFzNmxhU0hTd3Y0TTBV\nQ21WcnNqaHowL09QRlk1UWdOVUNwYXcKLS0tIHE0NzFIa3E0emNBZFZUMERuREpG\ncXpqR24xOUUzT3p2MHE1K2RzWkpodkEKS2Z3UK5jQPAzIjm9yNJU+6aeZ9nOUyZH\nSLzQPShGzSJCyPITPJ4FhAJLTr1+3IrY2SEsR7tSo+4aNmjncwS6pw==\n-----END AGE ENCRYPTED FILE-----\n" + }, + { + "recipient": "age13nrwdpkx23up6dre09mv5lh9lv3xynqf96sn3qlgykjmu6dzk44shvlh9n", + "enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBvbjhFSysycnhCdWd0OEdq\ndjRpVGtlTkQ5bHJzaitVTlIrRHYrSWpLUHprCjVKajZpa1pXUEVkSW9PWVEwbTEz\nd1o0ckJJTmlvMlBLL0VWcWNhSkg5YlUKLS0tIG5WU241aEhJajUrMDltaXJJUGZ5\nQ0N3cXB2c3Ntbm40eEVUM3BXbFhOTzAK9cJk3P3IPTIVwvg+wspZX1h8uWnUPGCZ\nQYip+uTg3rrvsYCcOhbscfcKvTS4bpz1bUx41OMB5f16cm3CPPHMTA==\n-----END AGE ENCRYPTED FILE-----\n" + } + ], + "lastmodified": "2024-11-15T18:44:35Z", + "mac": "ENC[AES256_GCM,data:lkB4JfLxtAKgc0VkViX3ezSFZFKgiXKPAjx4wkHX+akcibO9/clQpmSTghHqb4G3OeOSwaZOpU2qu0ZdN3BR2WNsI764eMXtVAsIxX6jAVfO4iCULipKS428ar5N3wkOMgfqTcRPAUOEzm5MxJRDHDJKwC6CUsA+u5Xp7aQPkfs=,iv:k5kcnE4tLWkvZrt3PsC2ao2Epl1PRxX3hdYIwcNkYnU=,tag:5fsTaljmiZvFD3MacTRnVg==,type:str]", + "pgp": null, + "unencrypted_suffix": "_unencrypted", + "version": "3.9.1" + } +} \ No newline at end of file From fd934a2d8b797a96eac9fcd19ceca7986fcd5e2b Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Sat, 30 Nov 2024 14:43:23 +0100 Subject: [PATCH 19/21] feat(wezterm): add keybindings for pane navigation --- home/features/global/wezterm.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/home/features/global/wezterm.nix b/home/features/global/wezterm.nix index d2b639e..902020c 100755 --- a/home/features/global/wezterm.nix +++ b/home/features/global/wezterm.nix @@ -45,6 +45,32 @@ }, keys = { + { + key = 'x', + mods = 'ALT', + action = wezterm.action.ActivateCopyMode, + }, + { + key = 'Space', + mods = 'ALT', + action = wezterm.action.QuickSelect, + }, + { + key = 'f', + mods = 'ALT', + action = wezterm.action.Search("CurrentSelectionOrEmptyString"), + }, + { + key = 'p', + mods = 'ALT', + action = wezterm.action.ActivateCommandPalette, + }, + + { + key = 's', + mods = 'ALT', + action = wezterm.action.PaneSelect, + }, { key = 'Tab', mods = 'ALT', From 6ae22d9a503d53aac392d66f1cc2e56078e3c96e Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Sun, 29 Dec 2024 16:08:23 +0100 Subject: [PATCH 20/21] feat(neovim): update --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 6676935..73d4ec5 100755 --- a/flake.lock +++ b/flake.lock @@ -603,11 +603,11 @@ "nixvim": "nixvim" }, "locked": { - "lastModified": 1730981937, - "narHash": "sha256-R3V/9ujK2KTk+dYgSNYNJN0wDOVCNP6dWb4aCwmaHg4=", + "lastModified": 1735484025, + "narHash": "sha256-nJW2S+KhsUkZ31TGH7VpYshJl9Miv2TqSggIhPOQTLg=", "owner": "NikodemMarek", "repo": "neovim", - "rev": "faa16703084dcf822671ad84fb57119963aa05b1", + "rev": "6c45fc34ef708fcc0e1843c098a79024838a897f", "type": "github" }, "original": { From b8dbaf3e41d8cf29947e67ef8c80e33e44fcaf75 Mon Sep 17 00:00:00 2001 From: NikodemMarek Date: Sun, 5 Jan 2025 15:40:00 +0100 Subject: [PATCH 21/21] feat(networking): agh guest network --- host/features/networking.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/host/features/networking.nix b/host/features/networking.nix index ba5f116..9ced84c 100755 --- a/host/features/networking.nix +++ b/host/features/networking.nix @@ -25,6 +25,7 @@ userControlled.enable = true; secretsFile = config.sops.secrets.networks.path; networks = { + "AGH-Guest" = {}; "Meshki56".pskRaw = "ext:PSK_Meshki56"; "308a_niezaliczan_semestranu".pskRaw = "ext:PSK_308a_niezaliczan_semestranu"; "hot_pot" = {