From 4141beb4cfb95d010372beebb3456c87caa4512b Mon Sep 17 00:00:00 2001 From: mrsu Date: Thu, 6 Jun 2024 18:09:29 +0100 Subject: [PATCH 01/18] flake.lock --- flake.lock | 417 ----------------------------------------------------- 1 file changed, 417 deletions(-) delete mode 100644 flake.lock diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 0aa38c0..0000000 --- a/flake.lock +++ /dev/null @@ -1,417 +0,0 @@ -{ - "nodes": { - "devshell": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": [ - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1713532798, - "narHash": "sha256-wtBhsdMJA3Wa32Wtm1eeo84GejtI43pMrFrmwLXrsEc=", - "owner": "numtide", - "repo": "devshell", - "rev": "12e914740a25ea1891ec619bb53cf5e6ca922e40", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, - "disko": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1717032306, - "narHash": "sha256-s3Sis+M1qTSVIehHrEKBzHBpqprIFJli5V6WojkJnYE=", - "owner": "nix-community", - "repo": "disko", - "rev": "8ea5bcccc03111bdedaeaae9380dfab61e9deb33", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "disko", - "type": "github" - } - }, - "flake-compat": { - "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "revCount": 57, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" - } - }, - "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-parts": { - "inputs": { - "nixpkgs-lib": [ - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715865404, - "narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-root": { - "locked": { - "lastModified": 1713493429, - "narHash": "sha256-ztz8JQkI08tjKnsTpfLqzWoKFQF4JGu2LRz8bkdnYUk=", - "owner": "srid", - "repo": "flake-root", - "rev": "bc748b93b86ee76e2032eecda33440ceb2532fcd", - "type": "github" - }, - "original": { - "owner": "srid", - "repo": "flake-root", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "git-hooks": { - "inputs": { - "flake-compat": "flake-compat_2", - "gitignore": "gitignore", - "nixpkgs": [ - "nixvim", - "nixpkgs" - ], - "nixpkgs-stable": [ - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1716213921, - "narHash": "sha256-xrsYFST8ij4QWaV6HEokCUNIZLjjLP1bYC60K8XiBVA=", - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "0e8fcc54b842ad8428c9e705cb5994eaf05c26a0", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "nixvim", - "git-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1717052710, - "narHash": "sha256-LRhOxzXmOza5SymhOgnEzA8EAQp+94kkeUYWKKpLJ/U=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "29c69d9a466e41d46fd3a7a9d0591ef9c113c2ae", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "home-manager_2": { - "inputs": { - "nixpkgs": [ - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1717052710, - "narHash": "sha256-LRhOxzXmOza5SymhOgnEzA8EAQp+94kkeUYWKKpLJ/U=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "29c69d9a466e41d46fd3a7a9d0591ef9c113c2ae", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "impermanence": { - "locked": { - "lastModified": 1708968331, - "narHash": "sha256-VUXLaPusCBvwM3zhGbRIJVeYluh2uWuqtj4WirQ1L9Y=", - "owner": "nix-community", - "repo": "impermanence", - "rev": "a33ef102a02ce77d3e39c25197664b7a636f9c30", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "impermanence", - "type": "github" - } - }, - "nix-darwin": { - "inputs": { - "nixpkgs": [ - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1716993688, - "narHash": "sha256-vo5k2wQekfeoq/2aleQkBN41dQiQHNTniZeVONWiWLs=", - "owner": "lnl7", - "repo": "nix-darwin", - "rev": "c0d5b8c54d6828516c97f6be9f2d00c63a363df4", - "type": "github" - }, - "original": { - "owner": "lnl7", - "repo": "nix-darwin", - "type": "github" - } - }, - "nix-secrets": { - "flake": false, - "locked": { - "lastModified": 1717081517, - "narHash": "sha256-Pvennf20SmdaJ7mZK4I3jjQX8jQy9Hd/KeE64e2uqHU=", - "ref": "refs/heads/master", - "rev": "c9a84172f898001d8e1732e7b6872be9d9352cef", - "revCount": 80, - "type": "git", - "url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git" - }, - "original": { - "type": "git", - "url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1716977081, - "narHash": "sha256-pFe5jLeIPlKEln5n2h998d7cpzXFdbrBMRe3suz4K1o=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ac82a513e55582291805d6f09d35b6d8b60637a1", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1716655032, - "narHash": "sha256-kQ25DAiCGigsNR/Quxm3v+JGXAEXZ8I7RAF4U94bGzE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "59a450646ec8ee0397f5fa54a08573e8240eb91f", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "release-23.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-unstable": { - "locked": { - "lastModified": 1716948383, - "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "ad57eef4ef0659193044870c731987a6df5cf56b", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixvim": { - "inputs": { - "devshell": "devshell", - "flake-compat": "flake-compat", - "flake-parts": "flake-parts", - "flake-root": "flake-root", - "git-hooks": "git-hooks", - "home-manager": "home-manager_2", - "nix-darwin": "nix-darwin", - "nixpkgs": [ - "nixpkgs" - ], - "treefmt-nix": "treefmt-nix" - }, - "locked": { - "lastModified": 1717081007, - "narHash": "sha256-GNr1i6itjFKGXSco3lcdKe8GxEwrmSYFDUpZyXsXWp4=", - "owner": "nix-community", - "repo": "nixvim", - "rev": "da9bd1f2e8fc8cd8553a76a9e22afd386c18f205", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixvim", - "type": "github" - } - }, - "root": { - "inputs": { - "disko": "disko", - "home-manager": "home-manager", - "impermanence": "impermanence", - "nix-secrets": "nix-secrets", - "nixpkgs": "nixpkgs", - "nixpkgs-unstable": "nixpkgs-unstable", - "nixvim": "nixvim", - "sops-nix": "sops-nix" - } - }, - "sops-nix": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" - }, - "locked": { - "lastModified": 1716692524, - "narHash": "sha256-sALodaA7Zkp/JD6ehgwc0UCBrSBfB4cX66uFGTsqeFU=", - "owner": "mic92", - "repo": "sops-nix", - "rev": "962797a8d7f15ed7033031731d0bb77244839960", - "type": "github" - }, - "original": { - "owner": "mic92", - "repo": "sops-nix", - "type": "github" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715940852, - "narHash": "sha256-wJqHMg/K6X3JGAE9YLM0LsuKrKb4XiBeVaoeMNlReZg=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "2fba33a182602b9d49f0b2440513e5ee091d838b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} From c1ad764777c3609df32615cfa66ffdc7e3330b5b Mon Sep 17 00:00:00 2001 From: mrsu Date: Thu, 13 Jun 2024 12:22:46 +0100 Subject: [PATCH 02/18] flake.lock --- flake.lock | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e69de29 From 2f3fec9e5c253ff42616ebd46e509173d67fcebc Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 13 Jun 2024 12:30:21 +0100 Subject: [PATCH 03/18] postgres credentials and dbt profiles --- flake.lock | 44 +++++++++++++++--------------- home/common/core/default.nix | 1 + hosts/common/users/sam/default.nix | 44 +++++++++++++++++++++++++++--- 3 files changed, 63 insertions(+), 26 deletions(-) diff --git a/flake.lock b/flake.lock index b633cf0..dd4795c 100644 --- a/flake.lock +++ b/flake.lock @@ -45,11 +45,11 @@ ] }, "locked": { - "lastModified": 1717637172, - "narHash": "sha256-geTO9YL1V9zYGxupuZvKFWxh6II9sH2bjI1dmEVhVYQ=", + "lastModified": 1717770040, + "narHash": "sha256-eq9gP060TqWqRf2k4WO5FrG49rVq5Jy3Ptusg0CFdds=", "owner": "nix-community", "repo": "disko", - "rev": "713aa3df481782719aed4d8c20ad31a9effe3564", + "rev": "398acc470f7c2d68621db01900f053e6000129c4", "type": "github" }, "original": { @@ -333,11 +333,11 @@ "nix-secrets": { "flake": false, "locked": { - "lastModified": 1717760051, - "narHash": "sha256-4yXaR3PIOJGQwTxA3eVDEu1iBlsmuvXWv3Ed0NrJgtU=", + "lastModified": 1717864759, + "narHash": "sha256-DUtmDvpNyOZG+UDONTBfRiAdCaI7E1ngVhmUOAjj3wg=", "ref": "refs/heads/master", - "rev": "521163d7278e71f084497910fa756bedcbfe97eb", - "revCount": 88, + "rev": "81aff439158dc6bb21251dc3be672db671e4a519", + "revCount": 89, "type": "git", "url": "ssh://git@git.bitlab21.com/sam/nix-secrets.git" }, @@ -407,11 +407,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1717737457, - "narHash": "sha256-hqHp0W7ibfdu5DFc6EG3S3c+GSAbti7VUldFXSf/WiI=", + "lastModified": 1717839683, + "narHash": "sha256-kC0eyEsfpXbtQ2Ee5kgjmLFSVsLgnqpj10LjEi+fK+g=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "bf3faad723ca984fc4ea95c1cee1d975a8ca2a28", + "rev": "3f3a01219b4a1b6ee63039a3aa63948fbf37c0dd", "type": "github" }, "original": { @@ -435,11 +435,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1717681257, - "narHash": "sha256-0PhFvfc4wDjba1cus2ALsfn0wVizeKkcuF+aqvDJivg=", + "lastModified": 1717861394, + "narHash": "sha256-U7E1Wg5PRKUYqfeL8H6KU/5VjFo8bkxbFzigN2grkQI=", "owner": "nix-community", "repo": "nixvim", - "rev": "36f2e51b28ee3389a67ed5e9ed5c4bd388b06918", + "rev": "db32ebe205111af0b74d74684df64674ffcf3b36", "type": "github" }, "original": { @@ -450,11 +450,11 @@ }, "nur": { "locked": { - "lastModified": 1717749895, - "narHash": "sha256-E6fEND68P37NMIhPyvgZl0jD7KlSg2QKZ1zpsXpobfQ=", + "lastModified": 1717864805, + "narHash": "sha256-iu5gmYBncm1c+FSFmHiRkEvbcWpH/ZO/MQYe0r5ng7s=", "owner": "nix-community", "repo": "NUR", - "rev": "b93b6c0b706d78ad95d52104728fd6eed3460f80", + "rev": "e212541138b753c7bc5215524215e2a07403df8d", "type": "github" }, "original": { @@ -475,11 +475,11 @@ "treefmt-nix": "treefmt-nix_2" }, "locked": { - "lastModified": 1717602370, - "narHash": "sha256-qS/7is9JbnnycR6QmndsuTQfifWzjhgxObnXw+iHdP8=", + "lastModified": 1717774136, + "narHash": "sha256-comOhXDFUrbVba47gPenVBKy2foM3m3qOqpcP8umWDA=", "owner": "nix-community", "repo": "poetry2nix", - "rev": "81662ae1ad31491eae3bb1d976fb74c71853bc63", + "rev": "370da3b6fefc6c11367463b68d010f9950aaa80c", "type": "github" }, "original": { @@ -635,11 +635,11 @@ ] }, "locked": { - "lastModified": 1717182148, - "narHash": "sha256-Hi09/RoizxubRf3PHToT2Nm7TL8B/abSVa6q82uEgNI=", + "lastModified": 1717278143, + "narHash": "sha256-u10aDdYrpiGOLoxzY/mJ9llST9yO8Q7K/UlROoNxzDw=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "03b982b77df58d5974c61c6022085bafe780c1cf", + "rev": "3eb96ca1ae9edf792a8e0963cc92fddfa5a87706", "type": "github" }, "original": { diff --git a/home/common/core/default.nix b/home/common/core/default.nix index 3de98b8..7338634 100644 --- a/home/common/core/default.nix +++ b/home/common/core/default.nix @@ -20,6 +20,7 @@ btop htop postgresql + hugo ; }; home.stateVersion = "23.11"; diff --git a/hosts/common/users/sam/default.nix b/hosts/common/users/sam/default.nix index 8c5c1f2..03591ff 100644 --- a/hosts/common/users/sam/default.nix +++ b/hosts/common/users/sam/default.nix @@ -35,13 +35,15 @@ in mode = "0644"; owner = "${username}"; }; - "passwords/postgres" = { }; + "software/postgres/btc_models/password" = { }; + "software/postgres/btc_models/ip" = { }; + "software/postgres/btc_models/username" = { }; "software/zotero/username" = { }; "software/zotero/password" = { }; "software/zotero/guid" = { }; }; - # Setup postgres connections for db_ui + # Setup software specific templates for user # Should be part of home-manager - waiting for templates functionality # See here https://github.com/Mic92/sops-nix/issues/423 and here https://github.com/Mic92/sops-nix/issues/498 # TODO migrate db_ui connection to home-manager when issue 423 and 498 are resolved in github:Mic92/sops-nix @@ -52,14 +54,48 @@ in content = '' [ { - "url": "postgresql://postgres:${config.sops.placeholder."passwords/postgres"}@10.0.10.100/btc_models", + "url": "postgresql://${config.sops.placeholder."software/postgres/btc_models/username"}:${config.sops.placeholder."software/postgres/btc_models/password"}@${config.sops.placeholder."software/postgres/btc_models/ip"}/btc_models", "name": "btc_models" + }, + { + "url": "postgresql://${config.sops.placeholder."software/postgres/btc_models/username"}:${config.sops.placeholder."software/postgres/btc_models/password"}@${config.sops.placeholder."software/postgres/btc_models/ip"}/dev_btc_models", + "name": "dev_btc_models" } ] ''; }; - # The containing folders are created as root and if this is the first entry when writing keys, + sops.templates."dbt_profiles.yml" = { + path = "/home/${username}/.config/dbt/profiles.yml"; + owner = "${username}"; + mode = "0600"; + content = '' + bitcoin: + target: dev + outputs: + dev: + dbname: dev_btc_models + host: ${config.sops.placeholder."software/postgres/btc_models/ip"} + pass: '${config.sops.placeholder."software/postgres/btc_models/password"}' + port: 5432 + schema: models + threads: 6 + type: postgres + user: ${config.sops.placeholder."software/postgres/btc_models/username"} + prod: + dbname: btc_models + host: ${config.sops.placeholder."software/postgres/btc_models/ip"} + pass: '${config.sops.placeholder."software/postgres/btc_models/password"}' + port: 5432 + schema: models + threads: 6 + type: postgres + user: ${config.sops.placeholder."software/postgres/btc_models/username"} + + ''; + }; + + # The containing folders are created as root and if this is the first entry when writing files, # the ownership is busted and home-manager can't target because it can't write to these dirs... # FIXME: We might not need this depending on how https://github.com/Mic92/sops-nix/issues/381 is fixed system.activationScripts.sopsSetOwnwership = From 108f9b70285de181d4d9585a9c7362b985f54ae1 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 13 Jun 2024 14:36:34 +0100 Subject: [PATCH 04/18] dwm --- home/semita.nix | 1 - home/users/sam/default.nix | 23 ++++++++++++++++- hosts/common/optional/dwm.nix | 25 +++++++++++++++++++ .../optional/{displayManager => }/sddm.nix | 0 hosts/semita/default.nix | 5 ++-- 5 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 hosts/common/optional/dwm.nix rename hosts/common/optional/{displayManager => }/sddm.nix (100%) diff --git a/home/semita.nix b/home/semita.nix index c610e9b..2186de1 100644 --- a/home/semita.nix +++ b/home/semita.nix @@ -11,7 +11,6 @@ ./common/optional/git.nix ./common/optional/sops.nix ./common/optional/syncthing.nix - ./common/optional/desktop/hyprland ]; diff --git a/home/users/sam/default.nix b/home/users/sam/default.nix index beeb764..d611c12 100644 --- a/home/users/sam/default.nix +++ b/home/users/sam/default.nix @@ -1,4 +1,4 @@ -{ pkgs, outputs, ... }: +{ pkgs, outputs, config, ... }: { home.username = "sam"; @@ -54,6 +54,27 @@ qt.style.name = "adwaita-dark"; qt.style.package = pkgs.adwaita-qt; + # TODO configure x11 to look in .config/x11 + #home.file."${config.xdg.configHome}/x11/xinitrc" = { + home.file.".xinitrc" = { + recursive = true; + text = '' + if test -z "$DBUS_SESSION_BUS_ADDRESS"; then + eval $(dbus-launch --exit-with-session --sh-syntax) + fi + systemctl --user import-environment DISPLAY XAUTHORITY + + if command -v dbus-update-activation-environment >/dev/null 2>&1; then + dbus-update-activation-environment DISPLAY XAUTHORITY + fi + + export XSESSION_PID="$$" + exec dwm + + ''; + }; + + home.sessionVariables = { EDITOR = "nvim"; TERMINAL = "alacritty"; diff --git a/hosts/common/optional/dwm.nix b/hosts/common/optional/dwm.nix new file mode 100644 index 0000000..171438c --- /dev/null +++ b/hosts/common/optional/dwm.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: +{ + + services = { + libinput.enable = true; + xserver = { + enable = true; + xkb.layout = "gb"; + displayManager.startx.enable = true; + autorun = false; + windowManager.dwm = { + enable = true; + package = pkgs.dwm.overrideAttrs { + src = pkgs.fetchFromGitea { + domain = "git.bitlab21.com"; + owner = "sam"; + repo = "dwm"; + rev = "011c32e72e45b124ad6ab5c8185945cd2e637270"; + sha256 = "sha256-rFiGTynYPEDav7ydokkRAHpT2zPFtz+Hn9lZbufEOEg="; + }; + }; + }; + }; + }; +} diff --git a/hosts/common/optional/displayManager/sddm.nix b/hosts/common/optional/sddm.nix similarity index 100% rename from hosts/common/optional/displayManager/sddm.nix rename to hosts/common/optional/sddm.nix diff --git a/hosts/semita/default.nix b/hosts/semita/default.nix index 1a5e1f9..95759b4 100644 --- a/hosts/semita/default.nix +++ b/hosts/semita/default.nix @@ -1,4 +1,4 @@ -{ inputs, config, lib, pkgs, outputs,... }: +{ inputs, config, lib, pkgs, outputs, ... }: let # Disko setup fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence @@ -28,9 +28,8 @@ in # Import optional options ../common/optional/persistence.nix ../common/optional/pipewire.nix - ../common/optional/hyprland.nix - ../common/optional/displayManager/sddm.nix ../common/optional/openssh.nix + ../common/optional/dwm.nix ]; From 326d8fbae79880f42fc48e26448c123cef92ac6a Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 13 Jun 2024 17:31:49 +0100 Subject: [PATCH 05/18] st derivation and startx in hm --- .../optional/desktop/common/default.nix | 1 + .../optional/desktop/startx/default.nix | 27 ++++++++++ home/semita.nix | 1 + home/users/sam/default.nix | 21 -------- pkgs/default.nix | 1 + pkgs/st/default.nix | 51 +++++++++++++++++++ 6 files changed, 81 insertions(+), 21 deletions(-) create mode 100644 home/common/optional/desktop/startx/default.nix create mode 100644 pkgs/st/default.nix diff --git a/home/common/optional/desktop/common/default.nix b/home/common/optional/desktop/common/default.nix index 10be23e..49c9fd1 100644 --- a/home/common/optional/desktop/common/default.nix +++ b/home/common/optional/desktop/common/default.nix @@ -12,6 +12,7 @@ # Global packages for desktop environments home.packages = [ pkgs.alacritty + pkgs.st pkgs.libnotify pkgs.zathura pkgs.xfce.thunar diff --git a/home/common/optional/desktop/startx/default.nix b/home/common/optional/desktop/startx/default.nix new file mode 100644 index 0000000..cef6462 --- /dev/null +++ b/home/common/optional/desktop/startx/default.nix @@ -0,0 +1,27 @@ +{ + imports = [ + ../common + ]; + + # TODO configure x11 to look in .config/x11 + #home.file."${config.xdg.configHome}/x11/xinitrc" = { + home.file.".xinitrc" = { + recursive = true; + text = '' + if test -z "$DBUS_SESSION_BUS_ADDRESS"; then + eval $(dbus-launch --exit-with-session --sh-syntax) + fi + systemctl --user import-environment DISPLAY XAUTHORITY + + if command -v dbus-update-activation-environment >/dev/null 2>&1; then + dbus-update-activation-environment DISPLAY XAUTHORITY + fi + + export XSESSION_PID="$$" + exec dwm + + ''; + }; + + +} diff --git a/home/semita.nix b/home/semita.nix index 2186de1..a6dc6e0 100644 --- a/home/semita.nix +++ b/home/semita.nix @@ -11,6 +11,7 @@ ./common/optional/git.nix ./common/optional/sops.nix ./common/optional/syncthing.nix + ./common/optional/desktop/startx ]; diff --git a/home/users/sam/default.nix b/home/users/sam/default.nix index d611c12..616fcb8 100644 --- a/home/users/sam/default.nix +++ b/home/users/sam/default.nix @@ -54,27 +54,6 @@ qt.style.name = "adwaita-dark"; qt.style.package = pkgs.adwaita-qt; - # TODO configure x11 to look in .config/x11 - #home.file."${config.xdg.configHome}/x11/xinitrc" = { - home.file.".xinitrc" = { - recursive = true; - text = '' - if test -z "$DBUS_SESSION_BUS_ADDRESS"; then - eval $(dbus-launch --exit-with-session --sh-syntax) - fi - systemctl --user import-environment DISPLAY XAUTHORITY - - if command -v dbus-update-activation-environment >/dev/null 2>&1; then - dbus-update-activation-environment DISPLAY XAUTHORITY - fi - - export XSESSION_PID="$$" - exec dwm - - ''; - }; - - home.sessionVariables = { EDITOR = "nvim"; TERMINAL = "alacritty"; diff --git a/pkgs/default.nix b/pkgs/default.nix index 591d772..693502b 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -2,4 +2,5 @@ # You can build them using 'nix build .#example' pkgs: { sddm-theme = pkgs.callPackage ./sddm-theme { }; + st = pkgs.callPackage ./st { }; } diff --git a/pkgs/st/default.nix b/pkgs/st/default.nix new file mode 100644 index 0000000..ad3ba63 --- /dev/null +++ b/pkgs/st/default.nix @@ -0,0 +1,51 @@ +{ pkgs ? import { } +, fetchFromGitea ? pkgs.fetchFromGitea +, stdenv ? pkgs.stdenv +, pkg-config ? pkgs.pkg-config +, fontconfig ? pkgs.fontconfig +, freetype ? pkgs.freetype +, libX11 ? pkgs.xorg.libX11 +, libXft ? pkgs.xorg.libXft +, ncurses ? pkgs.ncurses +, extraLibs ? [ ] +}: +pkgs.stdenv.mkDerivation { + pname = "st"; + name = "st"; + + src = fetchFromGitea { + domain = "git.bitlab21.com"; + owner = "sam"; + repo = "st"; + rev = "1cde288ca34ad05984a0251a7879005128be085c"; + sha256 = "sha256-4W9w/Efk+YCSP1VuUFr+jPXIyrlpktwxRPUOZHTAtx8="; + }; + + makeFlags = [ + "PKG_CONFIG=${stdenv.cc.targetPrefix}pkg-config" + ]; + + nativeBuildInputs = [ + pkg-config + ncurses + fontconfig + freetype + ]; + + buildInputs = [ + libX11 + libXft + ] ++ extraLibs; + + installFlags = [ "PREFIX=$(out)" ]; + + buildPhase = '' + make + ''; + + installPhase = '' + mkdir -p $out/usr/local/bin + mv st $out/usr/local/bin + ''; + +} From 18448d340ac94e8c5ce760023b0b579d1da6609f Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 13 Jun 2024 17:44:06 +0100 Subject: [PATCH 06/18] dwmblocks derivation --- pkgs/dwmblocks/default.nix | 33 +++++++++++++++++++++++++++++++++ pkgs/st/default.nix | 16 +--------------- 2 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 pkgs/dwmblocks/default.nix diff --git a/pkgs/dwmblocks/default.nix b/pkgs/dwmblocks/default.nix new file mode 100644 index 0000000..b50e29f --- /dev/null +++ b/pkgs/dwmblocks/default.nix @@ -0,0 +1,33 @@ +{ pkgs ? import { } +, fetchFromGitea ? pkgs.fetchFromGitea + #, stdenv ? pkgs.stdenv + #, pkg-config ? pkgs.pkg-config + #, fontconfig ? pkgs.fontconfig + #, freetype ? pkgs.freetype + #, libX11 ? pkgs.xorg.libX11 + #, libXft ? pkgs.xorg.libXft + #, ncurses ? pkgs.ncurses + #, extraLibs ? [ ] +}: +pkgs.stdenv.mkDerivation { + pname = "dwmblocks"; + name = "dwmblocks"; + + src = fetchFromGitea { + domain = "git.bitlab21.com"; + owner = "sam"; + repo = "dwmblocks"; + rev = "c4e7a9b1eb98123e239ba76bc551934721fd18ca"; + sha256 = "sha256-4W9w/Efk+YCSP1VuUFr+jPXIyrlpktwxRPUOZHTAtx8="; + }; + + buildPhase = '' + make + ''; + + installPhase = '' + mkdir -p $out/usr/local/bin + mv st $out/usr/local/bin + ''; + +} diff --git a/pkgs/st/default.nix b/pkgs/st/default.nix index ad3ba63..fffa40e 100644 --- a/pkgs/st/default.nix +++ b/pkgs/st/default.nix @@ -1,13 +1,8 @@ { pkgs ? import { } , fetchFromGitea ? pkgs.fetchFromGitea -, stdenv ? pkgs.stdenv , pkg-config ? pkgs.pkg-config -, fontconfig ? pkgs.fontconfig -, freetype ? pkgs.freetype , libX11 ? pkgs.xorg.libX11 , libXft ? pkgs.xorg.libXft -, ncurses ? pkgs.ncurses -, extraLibs ? [ ] }: pkgs.stdenv.mkDerivation { pname = "st"; @@ -21,23 +16,14 @@ pkgs.stdenv.mkDerivation { sha256 = "sha256-4W9w/Efk+YCSP1VuUFr+jPXIyrlpktwxRPUOZHTAtx8="; }; - makeFlags = [ - "PKG_CONFIG=${stdenv.cc.targetPrefix}pkg-config" - ]; - nativeBuildInputs = [ pkg-config - ncurses - fontconfig - freetype ]; buildInputs = [ libX11 libXft - ] ++ extraLibs; - - installFlags = [ "PREFIX=$(out)" ]; + ]; buildPhase = '' make From e4161bfed9e631c57837f9c5573704b376e975ca Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 13 Jun 2024 23:33:14 +0100 Subject: [PATCH 07/18] dwmblocks sb scripts --- home/common/core/default.nix | 9 +++- .../optional/desktop/common/default.nix | 6 +-- .../desktop/{startx => dwm}/default.nix | 15 +++++++ .../optional/desktop/hyprland/default.nix | 1 - .../optional/desktop/status-bar/default.nix | 10 +++++ .../optional/desktop/status-bar/sb-cpu-pct.sh | 1 + .../optional/desktop/status-bar/sb-mem-pct.sh | 3 ++ .../desktop/status-bar/sb-network-status.sh | 43 +++++++++++++++++++ .../optional/desktop/status-bar/sb-updates.sh | 6 +++ .../optional/desktop/status-bar/sb-volume.sh | 41 ++++++++++++++++++ home/common/optional/git.nix | 2 +- home/semita.nix | 2 +- pkgs/default.nix | 1 + pkgs/dwmblocks/default.nix | 26 ++++++----- pkgs/st/default.nix | 4 +- 15 files changed, 147 insertions(+), 23 deletions(-) rename home/common/optional/desktop/{startx => dwm}/default.nix (73%) create mode 100644 home/common/optional/desktop/status-bar/default.nix create mode 100644 home/common/optional/desktop/status-bar/sb-cpu-pct.sh create mode 100644 home/common/optional/desktop/status-bar/sb-mem-pct.sh create mode 100644 home/common/optional/desktop/status-bar/sb-network-status.sh create mode 100644 home/common/optional/desktop/status-bar/sb-updates.sh create mode 100644 home/common/optional/desktop/status-bar/sb-volume.sh diff --git a/home/common/core/default.nix b/home/common/core/default.nix index 7338634..96d29e5 100644 --- a/home/common/core/default.nix +++ b/home/common/core/default.nix @@ -1,4 +1,4 @@ -{ pkgs, inputs, ... }: +{ pkgs, inputs, outputs, ... }: { imports = [ inputs.nix-colors.homeManagerModules.default @@ -7,6 +7,11 @@ ./fonts.nix ]; + nixpkgs.overlays = [ + inputs.nur.overlay + outputs.overlays.additions + ]; + # Global home packages without config go here (for all hosts and users) home.packages = builtins.attrValues { inherit (pkgs) @@ -20,7 +25,7 @@ btop htop postgresql - hugo + bc ; }; home.stateVersion = "23.11"; diff --git a/home/common/optional/desktop/common/default.nix b/home/common/optional/desktop/common/default.nix index 49c9fd1..58b2ba4 100644 --- a/home/common/optional/desktop/common/default.nix +++ b/home/common/optional/desktop/common/default.nix @@ -1,14 +1,10 @@ -{ pkgs, inputs, ... }: { +{ pkgs, ... }: { imports = [ ./firefox.nix ./alacritty.nix ./zotero.nix ]; - nixpkgs.overlays = [ - inputs.nur.overlay - ]; - # Global packages for desktop environments home.packages = [ pkgs.alacritty diff --git a/home/common/optional/desktop/startx/default.nix b/home/common/optional/desktop/dwm/default.nix similarity index 73% rename from home/common/optional/desktop/startx/default.nix rename to home/common/optional/desktop/dwm/default.nix index cef6462..975f7e3 100644 --- a/home/common/optional/desktop/startx/default.nix +++ b/home/common/optional/desktop/dwm/default.nix @@ -1,6 +1,13 @@ +{ pkgs, ... }: { + imports = [ ../common + ../status-bar + ]; + + home.packages = [ + pkgs.dwmblocks ]; # TODO configure x11 to look in .config/x11 @@ -8,6 +15,14 @@ home.file.".xinitrc" = { recursive = true; text = '' + + autostart="dwmblocks" + + for program in $autostart; do + pidof -sx "$program" || "$program" & + done >/dev/null 2>&1 + + if test -z "$DBUS_SESSION_BUS_ADDRESS"; then eval $(dbus-launch --exit-with-session --sh-syntax) fi diff --git a/home/common/optional/desktop/hyprland/default.nix b/home/common/optional/desktop/hyprland/default.nix index 563323c..eac93c1 100644 --- a/home/common/optional/desktop/hyprland/default.nix +++ b/home/common/optional/desktop/hyprland/default.nix @@ -1,6 +1,5 @@ { lib , config -, pkgs , ... }: { diff --git a/home/common/optional/desktop/status-bar/default.nix b/home/common/optional/desktop/status-bar/default.nix new file mode 100644 index 0000000..7e749cc --- /dev/null +++ b/home/common/optional/desktop/status-bar/default.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + home.packages = [ + (pkgs.writeShellScriptBin "sb-cpu-pct" (builtins.readFile ./sb-cpu-pct.sh)) + (pkgs.writeShellScriptBin "sb-mem-pct" (builtins.readFile ./sb-mem-pct.sh)) + (pkgs.writeShellScriptBin "sb-volume" (builtins.readFile ./sb-volume.sh)) + (pkgs.writeShellScriptBin "sb-network-status" (builtins.readFile ./sb-network-status.sh)) + (pkgs.writeShellScriptBin "sb-updates" (builtins.readFile ./sb-updates.sh)) + ]; +} diff --git a/home/common/optional/desktop/status-bar/sb-cpu-pct.sh b/home/common/optional/desktop/status-bar/sb-cpu-pct.sh new file mode 100644 index 0000000..ab61fb9 --- /dev/null +++ b/home/common/optional/desktop/status-bar/sb-cpu-pct.sh @@ -0,0 +1 @@ +echo $(top -bn 1 |grep "Cpu(s)" | awk '{print $2+$6 "%"}' | sed "s/\..//g") diff --git a/home/common/optional/desktop/status-bar/sb-mem-pct.sh b/home/common/optional/desktop/status-bar/sb-mem-pct.sh new file mode 100644 index 0000000..158d95b --- /dev/null +++ b/home/common/optional/desktop/status-bar/sb-mem-pct.sh @@ -0,0 +1,3 @@ +# Gets current ram percent utilisation + +echo $(free | awk '/^Mem/ {print "100*" $3 " / " $2 }' | bc | awk '{print $1"%"}') diff --git a/home/common/optional/desktop/status-bar/sb-network-status.sh b/home/common/optional/desktop/status-bar/sb-network-status.sh new file mode 100644 index 0000000..d8e09ef --- /dev/null +++ b/home/common/optional/desktop/status-bar/sb-network-status.sh @@ -0,0 +1,43 @@ +# Nerd Font Symbols +wifi_symbol=" " +lan_symbol="󰌗 " +disconnected_symbol="󰲜 " +vpn_symbol="󰖂 " +internet="󰞉 " +internet_disconnected="󰪎 " + +# Get the network status +DEFAULT_INTERFACE=$(ip route | grep '^default' | awk '{print $5}' | uniq) +IP_ADDRESS=$(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p') + +if [ -z "$DEFAULT_INTERFACE" ]; then + network_symbol="$disconnected_symbol" +else + # Check if it is a wireless interface (wlan*) + if [[ $DEFAULT_INTERFACE == wl* ]]; then + network_symbol="$wifi_symbol" + else + network_symbol="$lan_symbol" + fi +fi + +# Check internet connectivity +if ! ping -c 1 8.8.8.8 &> /dev/null; +then + network_symbol="$network_symbol $internet_disconnected" +else + network_symbol="$network_symbol $internet" +fi + +if ip addr show tun0 > /dev/null 2>&1; then + network_symbol="$network_symbol $vpn_symbol" +else + network_symbol="$network_symbol" +fi + +if [ -z "$IP_ADDRESS" ]; +then + printf "$network_symbol" +else +printf "$network_symbol|$IP_ADDRESS" +fi diff --git a/home/common/optional/desktop/status-bar/sb-updates.sh b/home/common/optional/desktop/status-bar/sb-updates.sh new file mode 100644 index 0000000..80bb055 --- /dev/null +++ b/home/common/optional/desktop/status-bar/sb-updates.sh @@ -0,0 +1,6 @@ +# Gets number of flake inputs that are ready for update +# Checks every 60 minutes +inputs=$(cd /etc/nixos && + nix flake update --output-lock-file <(cat flake.nix) 2> /tmp/update && + cat /tmp/update | grep -c Update) +printf " $inputs" diff --git a/home/common/optional/desktop/status-bar/sb-volume.sh b/home/common/optional/desktop/status-bar/sb-volume.sh new file mode 100644 index 0000000..1da6af3 --- /dev/null +++ b/home/common/optional/desktop/status-bar/sb-volume.sh @@ -0,0 +1,41 @@ +# Prints the current volume or 婢 if muted. + +case $BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e pulsemixer ;; + 2) pamixer -t && pkill -RTMIN+10 dwmblocks && exit 1 ;; + 4) pamixer --set-limit 150 --allow-boost -i 1 && pkill -RTMIN+10 dwmblocks && exit 1 ;; + 5) pamixer --set-limit 150 --allow-boost -d 1 && pkill -RTMIN+10 dwmblocks && exit 1 ;; + 3) notify-send "Volume module" "\- Shows volume , 婢 if muted. +- Middle click to mute. +- Scroll to change." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +get_mic_status=$(pamixer --default-source --get-mute) +vol="$(pamixer --get-volume)" + +if [ $get_mic_status == false ]; then + mic_status="" +else + mic_status="" +fi + +if [ "$vol" -gt "90" ]; then + icon="" +elif [ "$vol" -gt "50" ]; then + icon="󰕾" +elif [ "$vol" -gt "30" ]; then + icon="" +elif [ "$vol" -gt "0" ]; then + icon="󰕿" +else + icon="󰝟" +fi + +if [ $(pamixer --get-mute) = true ]; then + icon="󰸈" + vol="0" +fi + +print_string="$mic_status $icon $vol%" +printf '%s' "${print_string}" diff --git a/home/common/optional/git.nix b/home/common/optional/git.nix index a6e6ebf..0f719b2 100644 --- a/home/common/optional/git.nix +++ b/home/common/optional/git.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, config, ... }: +{ pkgs, ... }: { programs.git = { enable = true; diff --git a/home/semita.nix b/home/semita.nix index a6dc6e0..100441e 100644 --- a/home/semita.nix +++ b/home/semita.nix @@ -11,7 +11,7 @@ ./common/optional/git.nix ./common/optional/sops.nix ./common/optional/syncthing.nix - ./common/optional/desktop/startx + ./common/optional/desktop/dwm ]; diff --git a/pkgs/default.nix b/pkgs/default.nix index 693502b..bf3e172 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -3,4 +3,5 @@ pkgs: { sddm-theme = pkgs.callPackage ./sddm-theme { }; st = pkgs.callPackage ./st { }; + dwmblocks = pkgs.callPackage ./dwmblocks { }; } diff --git a/pkgs/dwmblocks/default.nix b/pkgs/dwmblocks/default.nix index b50e29f..d118abe 100644 --- a/pkgs/dwmblocks/default.nix +++ b/pkgs/dwmblocks/default.nix @@ -1,13 +1,8 @@ { pkgs ? import { } , fetchFromGitea ? pkgs.fetchFromGitea - #, stdenv ? pkgs.stdenv - #, pkg-config ? pkgs.pkg-config - #, fontconfig ? pkgs.fontconfig - #, freetype ? pkgs.freetype - #, libX11 ? pkgs.xorg.libX11 - #, libXft ? pkgs.xorg.libXft - #, ncurses ? pkgs.ncurses - #, extraLibs ? [ ] +, pkg-config ? pkgs.pkg-config +, libX11 ? pkgs.xorg.libX11 +, libXft ? pkgs.xorg.libXft }: pkgs.stdenv.mkDerivation { pname = "dwmblocks"; @@ -18,16 +13,25 @@ pkgs.stdenv.mkDerivation { owner = "sam"; repo = "dwmblocks"; rev = "c4e7a9b1eb98123e239ba76bc551934721fd18ca"; - sha256 = "sha256-4W9w/Efk+YCSP1VuUFr+jPXIyrlpktwxRPUOZHTAtx8="; + sha256 = "sha256-F1x8jOT+c2pPCF9qKq5boIWzegMBTCxwzKMVtmtMWGM="; }; + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ + libX11 + libXft + ]; + buildPhase = '' make ''; installPhase = '' - mkdir -p $out/usr/local/bin - mv st $out/usr/local/bin + mkdir -p $out/bin + mv dwmblocks $out/bin ''; } diff --git a/pkgs/st/default.nix b/pkgs/st/default.nix index fffa40e..2591bb4 100644 --- a/pkgs/st/default.nix +++ b/pkgs/st/default.nix @@ -30,8 +30,8 @@ pkgs.stdenv.mkDerivation { ''; installPhase = '' - mkdir -p $out/usr/local/bin - mv st $out/usr/local/bin + mkdir -p $out/bin + mv st $out/bin ''; } From a9ecc94a77a9dd12a6f27613325144763083d2f4 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 13 Jun 2024 23:39:22 +0100 Subject: [PATCH 08/18] home x11 dir & pkill update-flake --- flake.lock | 84 ++++++++++---------- home/common/optional/desktop/dwm/default.nix | 1 + home/common/optional/desktop/x11/default.nix | 10 +++ justfile | 3 +- 4 files changed, 55 insertions(+), 43 deletions(-) create mode 100644 home/common/optional/desktop/x11/default.nix diff --git a/flake.lock b/flake.lock index d424eaa..042f860 100644 --- a/flake.lock +++ b/flake.lock @@ -45,11 +45,11 @@ ] }, "locked": { - "lastModified": 1717770040, - "narHash": "sha256-eq9gP060TqWqRf2k4WO5FrG49rVq5Jy3Ptusg0CFdds=", + "lastModified": 1718242063, + "narHash": "sha256-n3AWItJ4a94GT0cray/eUV7tt3mulQ52L+lWJN9d1E8=", "owner": "nix-community", "repo": "disko", - "rev": "398acc470f7c2d68621db01900f053e6000129c4", + "rev": "832a9f2c81ff3485404bd63952eadc17bf7ccef2", "type": "github" }, "original": { @@ -219,11 +219,11 @@ ] }, "locked": { - "lastModified": 1717525419, - "narHash": "sha256-5z2422pzWnPXHgq2ms8lcCfttM0dz+hg+x1pCcNkAws=", + "lastModified": 1718243258, + "narHash": "sha256-abBpj2VU8p6qlRzTU8o22q68MmOaZ4v8zZ4UlYl5YRU=", "owner": "nix-community", "repo": "home-manager", - "rev": "a7117efb3725e6197dd95424136f79147aa35e5b", + "rev": "8d5e27b4807d25308dfe369d5a923d87e7dbfda3", "type": "github" }, "original": { @@ -240,11 +240,11 @@ ] }, "locked": { - "lastModified": 1717525419, - "narHash": "sha256-5z2422pzWnPXHgq2ms8lcCfttM0dz+hg+x1pCcNkAws=", + "lastModified": 1718141734, + "narHash": "sha256-cA+6l8ZCZ7MXGijVuY/1f55+wF/RT4PlTR9+g4bx86w=", "owner": "nix-community", "repo": "home-manager", - "rev": "a7117efb3725e6197dd95424136f79147aa35e5b", + "rev": "892f76bd0aa09a0f7f73eb41834b8a904b6d0fad", "type": "github" }, "original": { @@ -255,11 +255,11 @@ }, "impermanence": { "locked": { - "lastModified": 1708968331, - "narHash": "sha256-VUXLaPusCBvwM3zhGbRIJVeYluh2uWuqtj4WirQ1L9Y=", + "lastModified": 1717932370, + "narHash": "sha256-7C5lCpiWiyPoIACOcu2mukn/1JRtz6HC/1aEMhUdcw0=", "owner": "nix-community", "repo": "impermanence", - "rev": "a33ef102a02ce77d3e39c25197664b7a636f9c30", + "rev": "27979f1c3a0d3b9617a3563e2839114ba7d48d3f", "type": "github" }, "original": { @@ -295,11 +295,11 @@ ] }, "locked": { - "lastModified": 1716993688, - "narHash": "sha256-vo5k2wQekfeoq/2aleQkBN41dQiQHNTniZeVONWiWLs=", + "lastModified": 1717976995, + "narHash": "sha256-u3HBinyIyUvL1+N816bODpJmSQdgn0Mbb8BprFw7kqo=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "c0d5b8c54d6828516c97f6be9f2d00c63a363df4", + "rev": "315aa649ba307704db0b16c92f097a08a65ec955", "type": "github" }, "original": { @@ -375,11 +375,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1717265169, - "narHash": "sha256-IITcGd6xpNoyq9SZBigCkv4+qMHSqot0RDPR4xsZ2CA=", + "lastModified": 1717880976, + "narHash": "sha256-BRvSCsKtDUr83NEtbGfHLUOdDK0Cgbezj2PtcHnz+sQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3b1b4895b2c5f9f5544d02132896aeb9ceea77bc", + "rev": "4913a7c3d8b8d00cb9476a6bd730ff57777f740c", "type": "github" }, "original": { @@ -391,11 +391,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1717602782, - "narHash": "sha256-pL9jeus5QpX5R+9rsp3hhZ+uplVHscNJh8n8VpqscM0=", + "lastModified": 1718160348, + "narHash": "sha256-9YrUjdztqi4Gz8n3mBuqvCkMo4ojrA6nASwyIKWMpus=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e8057b67ebf307f01bdcc8fba94d94f75039d1f6", + "rev": "57d6973abba7ea108bac64ae7629e7431e0199b6", "type": "github" }, "original": { @@ -407,11 +407,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1717839683, - "narHash": "sha256-kC0eyEsfpXbtQ2Ee5kgjmLFSVsLgnqpj10LjEi+fK+g=", + "lastModified": 1718267761, + "narHash": "sha256-cNvy96/8JSSAQ7/o10ZzQSr+AUelhW4pcNPPYDbhS9o=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3f3a01219b4a1b6ee63039a3aa63948fbf37c0dd", + "rev": "21d22ef2ea511a82e20654d20ed493cef5690084", "type": "github" }, "original": { @@ -435,11 +435,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1717861394, - "narHash": "sha256-U7E1Wg5PRKUYqfeL8H6KU/5VjFo8bkxbFzigN2grkQI=", + "lastModified": 1718290136, + "narHash": "sha256-BQFspZqwA56LOIQ0ypw54Nal/BLFUpnZTqoXxeiSTNE=", "owner": "nix-community", "repo": "nixvim", - "rev": "db32ebe205111af0b74d74684df64674ffcf3b36", + "rev": "80c03843e7ad7fc7deb0dce6d1f6fc45593ed91d", "type": "github" }, "original": { @@ -450,11 +450,11 @@ }, "nur": { "locked": { - "lastModified": 1717872410, - "narHash": "sha256-kL4bugfx+R4ozR6t8MrGSdv3LVX7H9IkCxmvjaLAQ7o=", + "lastModified": 1718310343, + "narHash": "sha256-jD2XqvofA5hdROv8OSTss/vjJi164Mjavgh2yJf2ej4=", "owner": "nix-community", "repo": "NUR", - "rev": "3b134079df522044c0da57f1b7785646a7b76518", + "rev": "ca312c14ad9abbb8736b9f9fd6fa8b8f60b2f1b2", "type": "github" }, "original": { @@ -475,11 +475,11 @@ "treefmt-nix": "treefmt-nix_2" }, "locked": { - "lastModified": 1717774136, - "narHash": "sha256-comOhXDFUrbVba47gPenVBKy2foM3m3qOqpcP8umWDA=", + "lastModified": 1718285706, + "narHash": "sha256-DScsBM+kZvxOva7QegfdtleebMXh30XPxDQr/1IGKYo=", "owner": "nix-community", "repo": "poetry2nix", - "rev": "370da3b6fefc6c11367463b68d010f9950aaa80c", + "rev": "a5be1bbbe0af0266147a88e0ec43b18c722f2bb9", "type": "github" }, "original": { @@ -511,11 +511,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1717455931, - "narHash": "sha256-8Q6mKSsto8gaGczXd4G0lvawdAYLa5Dlh3/g4hl5CaM=", + "lastModified": 1718137936, + "narHash": "sha256-psA+1Q5fPaK6yI3vzlLINNtb6EeXj111zQWnZYyJS9c=", "owner": "mic92", "repo": "sops-nix", - "rev": "d4555e80d80d2fa77f0a44201ca299f9602492a0", + "rev": "c279dec105dd53df13a5e57525da97905cc0f0d6", "type": "github" }, "original": { @@ -613,11 +613,11 @@ ] }, "locked": { - "lastModified": 1717278143, - "narHash": "sha256-u10aDdYrpiGOLoxzY/mJ9llST9yO8Q7K/UlROoNxzDw=", + "lastModified": 1718139168, + "narHash": "sha256-1TZQcdETNdJMcfwwoshVeCjwWfrPtkSQ8y8wFX3it7k=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "3eb96ca1ae9edf792a8e0963cc92fddfa5a87706", + "rev": "1cb529bffa880746a1d0ec4e0f5076876af931f1", "type": "github" }, "original": { @@ -635,11 +635,11 @@ ] }, "locked": { - "lastModified": 1717278143, - "narHash": "sha256-u10aDdYrpiGOLoxzY/mJ9llST9yO8Q7K/UlROoNxzDw=", + "lastModified": 1717850719, + "narHash": "sha256-npYqVg+Wk4oxnWrnVG7416fpfrlRhp/lQ6wQ4DHI8YE=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "3eb96ca1ae9edf792a8e0963cc92fddfa5a87706", + "rev": "4fc1c45a5f50169f9f29f6a98a438fb910b834ed", "type": "github" }, "original": { diff --git a/home/common/optional/desktop/dwm/default.nix b/home/common/optional/desktop/dwm/default.nix index 975f7e3..a0479a2 100644 --- a/home/common/optional/desktop/dwm/default.nix +++ b/home/common/optional/desktop/dwm/default.nix @@ -4,6 +4,7 @@ imports = [ ../common ../status-bar + ../x11 ]; home.packages = [ diff --git a/home/common/optional/desktop/x11/default.nix b/home/common/optional/desktop/x11/default.nix new file mode 100644 index 0000000..b1a07bf --- /dev/null +++ b/home/common/optional/desktop/x11/default.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + imports = [ + ]; + + home.packages = [ + pkgs.dunst + pkgs.flameshot + ]; +} diff --git a/justfile b/justfile index 51f050b..2ba40f8 100644 --- a/justfile +++ b/justfile @@ -6,8 +6,8 @@ default: # fetches from remote and updates flake.lock with latest revisions of nix-secrets for next time a rebuild occurs update-flake-secrets: - (cd ../nix-secrets && git fetch && git rebase) || true nix flake lock --update-input nix-secrets + pkill -RTMIN+11 dwmblocks # full system rebuild from flake (stages changes and automatically detects host) rebuild-system: @@ -17,6 +17,7 @@ rebuild-system: # updates all flake inputs for system update-flake: nix flake update + pkill -RTMIN+11 dwmblocks # edit sops file edit-sops: From 658744d33cdcbd8536c3a21782ae7770616d09f1 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 14 Jun 2024 00:39:02 +0100 Subject: [PATCH 09/18] feh-wallpaper-changer --- home/common/optional/desktop/dwm/default.nix | 2 +- home/common/optional/desktop/x11/default.nix | 1 + .../desktop/x11/feh-wallpaper-changer.nix | 27 +++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 home/common/optional/desktop/x11/feh-wallpaper-changer.nix diff --git a/home/common/optional/desktop/dwm/default.nix b/home/common/optional/desktop/dwm/default.nix index a0479a2..95dcaff 100644 --- a/home/common/optional/desktop/dwm/default.nix +++ b/home/common/optional/desktop/dwm/default.nix @@ -17,7 +17,7 @@ recursive = true; text = '' - autostart="dwmblocks" + autostart="dwmblocks feh-wallpaper-changer" for program in $autostart; do pidof -sx "$program" || "$program" & diff --git a/home/common/optional/desktop/x11/default.nix b/home/common/optional/desktop/x11/default.nix index b1a07bf..46db9da 100644 --- a/home/common/optional/desktop/x11/default.nix +++ b/home/common/optional/desktop/x11/default.nix @@ -1,6 +1,7 @@ { pkgs, ... }: { imports = [ + ./feh-wallpaper-changer.nix ]; home.packages = [ diff --git a/home/common/optional/desktop/x11/feh-wallpaper-changer.nix b/home/common/optional/desktop/x11/feh-wallpaper-changer.nix new file mode 100644 index 0000000..cfa8550 --- /dev/null +++ b/home/common/optional/desktop/x11/feh-wallpaper-changer.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "feh-wallpaper-changer" '' + wallpaper_dir="$HOME/.local/share/bg/" + if [ ! -d "$wallpaper_dir" ]; then + echo "No wallpapers in $wallpaper_dir, cloning from remote" + mkdir -p "$wallpaper_dir" + git clone https://git.bitlab21.com/sam/minimalistic-wallpaper-collection.git "$wallpaper_dir/minimalistic-wallpaper-collection" + [ $? != 0 ] && echo "cloning from gitea failed, exiting" && exit 1 + fi + pics_exist=$(find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \)) + if [ -z "$pics_exist" ]; then + git clone https://git.bitlab21.com/sam/minimalistic-wallpaper-collection.git "$wallpaper_dir/minimalistic-wallpaper-collection" + [ $? != 0 ] && echo "cloning from gitea failed, exiting" && exit 1 + fi + + while true; do + find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \) | shuf | while read -r file; do + ${feh}/bin/feh --bg-fill "$file" + [ $? != 0 ] && echo "feh failed, exiting" && exit 1 + sleep 600 + done + done + '') + ]; +} From c226add411c205d26918494741613e312371f6f9 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 14 Jun 2024 12:18:25 +0100 Subject: [PATCH 10/18] added dmenu and moved st to x11 --- .../optional/desktop/common/default.nix | 1 - home/common/optional/desktop/x11/default.nix | 2 + pkgs/default.nix | 1 + pkgs/dmenu/default.nix | 39 +++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 pkgs/dmenu/default.nix diff --git a/home/common/optional/desktop/common/default.nix b/home/common/optional/desktop/common/default.nix index 58b2ba4..de06d13 100644 --- a/home/common/optional/desktop/common/default.nix +++ b/home/common/optional/desktop/common/default.nix @@ -8,7 +8,6 @@ # Global packages for desktop environments home.packages = [ pkgs.alacritty - pkgs.st pkgs.libnotify pkgs.zathura pkgs.xfce.thunar diff --git a/home/common/optional/desktop/x11/default.nix b/home/common/optional/desktop/x11/default.nix index 46db9da..99fd438 100644 --- a/home/common/optional/desktop/x11/default.nix +++ b/home/common/optional/desktop/x11/default.nix @@ -7,5 +7,7 @@ home.packages = [ pkgs.dunst pkgs.flameshot + pkgs.st + pkgs.dmenu ]; } diff --git a/pkgs/default.nix b/pkgs/default.nix index bf3e172..5c3ecc4 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -4,4 +4,5 @@ pkgs: { sddm-theme = pkgs.callPackage ./sddm-theme { }; st = pkgs.callPackage ./st { }; dwmblocks = pkgs.callPackage ./dwmblocks { }; + dmenu = pkgs.callPackage ./dmenu { }; } diff --git a/pkgs/dmenu/default.nix b/pkgs/dmenu/default.nix new file mode 100644 index 0000000..f7ac6b4 --- /dev/null +++ b/pkgs/dmenu/default.nix @@ -0,0 +1,39 @@ +{ pkgs ? import { } +, fetchFromGitea ? pkgs.fetchFromGitea +, pkg-config ? pkgs.pkg-config +, libX11 ? pkgs.xorg.libX11 +, libXft ? pkgs.xorg.libXft +, libXinerama ? pkgs.xorg.libXinerama +}: +pkgs.stdenv.mkDerivation { + pname = "dmenu"; + name = "dmenu"; + + src = fetchFromGitea { + domain = "git.bitlab21.com"; + owner = "sam"; + repo = "dmenu"; + rev = "deb38655db2ddb340258381f3a0a59e2d19207f1"; + sha256 = "sha256-Wm5mIw4r3lPZDXlyO26Jr993Rq7dxMwBxeWnJ4UzQ1s="; + }; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ + libX11 + libXft + libXinerama + ]; + + buildPhase = '' + make + ''; + + installPhase = '' + mkdir -p $out/bin + mv dmenu dmenu_run dmenu_path stest $out/bin + ''; + +} From 2aea6ff2f4a45ae8314497a12a022c205ddd09d4 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 14 Jun 2024 17:31:17 +0100 Subject: [PATCH 11/18] fonts and xresources for dwm/st --- home/common/core/fonts.nix | 12 ++++--- .../optional/desktop/common/default.nix | 1 + .../optional/desktop/common/fontconfig.nix | 11 +++++++ home/common/optional/desktop/dwm/default.nix | 3 ++ home/common/optional/desktop/x11/default.nix | 31 +++++++++++++++++++ hosts/common/optional/dwm.nix | 4 +-- pkgs/st/default.nix | 4 +-- 7 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 home/common/optional/desktop/common/fontconfig.nix diff --git a/home/common/core/fonts.nix b/home/common/core/fonts.nix index 2ee9f38..420fe13 100644 --- a/home/common/core/fonts.nix +++ b/home/common/core/fonts.nix @@ -1,10 +1,14 @@ { pkgs, ... }: { fonts.fontconfig.enable = true; - home.packages = [ - pkgs.noto-fonts - pkgs.nerdfonts # loads the complete collection. look into overide for FiraMono or potentially mononoki - pkgs.meslo-lgs-nf + home.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + hack-font + liberation_ttf + font-awesome + libertine ]; } diff --git a/home/common/optional/desktop/common/default.nix b/home/common/optional/desktop/common/default.nix index de06d13..b989fba 100644 --- a/home/common/optional/desktop/common/default.nix +++ b/home/common/optional/desktop/common/default.nix @@ -3,6 +3,7 @@ ./firefox.nix ./alacritty.nix ./zotero.nix + ./fontconfig.nix ]; # Global packages for desktop environments diff --git a/home/common/optional/desktop/common/fontconfig.nix b/home/common/optional/desktop/common/fontconfig.nix new file mode 100644 index 0000000..fd1e97c --- /dev/null +++ b/home/common/optional/desktop/common/fontconfig.nix @@ -0,0 +1,11 @@ +{}: { + fonts = { + fontconfig = { + defaultFonts = { + serif = [ "Noto Serif" ]; + sansSerif = [ "Linux Biolinum O" "Noto Color Emoji" "Font Awesome 6 Brands" ]; + monospace = [ "Hack" "Liberation Mono" "Noto Color Emoji" "Font Awesome 6 Brands" ]; + }; + }; + }; +} diff --git a/home/common/optional/desktop/dwm/default.nix b/home/common/optional/desktop/dwm/default.nix index 95dcaff..e0f045b 100644 --- a/home/common/optional/desktop/dwm/default.nix +++ b/home/common/optional/desktop/dwm/default.nix @@ -17,6 +17,9 @@ recursive = true; text = '' + picom -b --config ~/.config/picom/picom.conf + xrdb ~/.Xresources + autostart="dwmblocks feh-wallpaper-changer" for program in $autostart; do diff --git a/home/common/optional/desktop/x11/default.nix b/home/common/optional/desktop/x11/default.nix index 99fd438..30c936a 100644 --- a/home/common/optional/desktop/x11/default.nix +++ b/home/common/optional/desktop/x11/default.nix @@ -9,5 +9,36 @@ pkgs.flameshot pkgs.st pkgs.dmenu + pkgs.picom + pkgs.xclip ]; + + home.file.".Xresources" = { + recursive = true; + text = '' + !st terminal + st.alpha: 0.8 + *.font: monospace:pixelsize=21:antialias=true:autohint=true; + *.font2: NotoColorEmoji:pixelsize=19:antialias=true:autohint=true; + + ! dwm + dwm.borderpx: 3 + ''; + }; + + home.file.".config/picom/picom.conf" = { + recursive = true; + text = '' + vsync = true; + backend = "xrender"; + shadow = true; + shadow-radius = 10; + shadow-offset-x = -5; + shadow-offset-y = -5; + fading = true; + fade-in-step = 0.2; + fade-out-step = 0.2; + fade-delta = 50; + ''; + }; } diff --git a/hosts/common/optional/dwm.nix b/hosts/common/optional/dwm.nix index 171438c..9386358 100644 --- a/hosts/common/optional/dwm.nix +++ b/hosts/common/optional/dwm.nix @@ -15,8 +15,8 @@ domain = "git.bitlab21.com"; owner = "sam"; repo = "dwm"; - rev = "011c32e72e45b124ad6ab5c8185945cd2e637270"; - sha256 = "sha256-rFiGTynYPEDav7ydokkRAHpT2zPFtz+Hn9lZbufEOEg="; + rev = "52638a7cc6c886f6e85e850dea826e24bd963203"; + sha256 = "sha256-azIBPGY26g/gLwEPAQTCdBWl0Z/8q7msNNn9/mw0yHw="; }; }; }; diff --git a/pkgs/st/default.nix b/pkgs/st/default.nix index 2591bb4..130016e 100644 --- a/pkgs/st/default.nix +++ b/pkgs/st/default.nix @@ -12,8 +12,8 @@ pkgs.stdenv.mkDerivation { domain = "git.bitlab21.com"; owner = "sam"; repo = "st"; - rev = "1cde288ca34ad05984a0251a7879005128be085c"; - sha256 = "sha256-4W9w/Efk+YCSP1VuUFr+jPXIyrlpktwxRPUOZHTAtx8="; + rev = "31e0ba8cb2086fb12741afc5fc3dfd938ca1f59b"; + sha256 = "sha256-dbkXFbNr/lJveMeR7qXo7jGgF5+79S9vqKsLM7XM250="; }; nativeBuildInputs = [ From f3b506ac81e8fc5c2d286bd39e0d2ae40d54e5e7 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 14 Jun 2024 18:04:48 +0100 Subject: [PATCH 12/18] fix fonts --- home/common/core/fonts.nix | 2 +- home/common/optional/desktop/common/fontconfig.nix | 8 ++++---- hosts/common/optional/dwm.nix | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/home/common/core/fonts.nix b/home/common/core/fonts.nix index 420fe13..373905e 100644 --- a/home/common/core/fonts.nix +++ b/home/common/core/fonts.nix @@ -7,8 +7,8 @@ noto-fonts-emoji hack-font liberation_ttf - font-awesome libertine + nerdfonts ]; } diff --git a/home/common/optional/desktop/common/fontconfig.nix b/home/common/optional/desktop/common/fontconfig.nix index fd1e97c..805ad85 100644 --- a/home/common/optional/desktop/common/fontconfig.nix +++ b/home/common/optional/desktop/common/fontconfig.nix @@ -1,10 +1,10 @@ -{}: { +{ ... }: { fonts = { fontconfig = { defaultFonts = { - serif = [ "Noto Serif" ]; - sansSerif = [ "Linux Biolinum O" "Noto Color Emoji" "Font Awesome 6 Brands" ]; - monospace = [ "Hack" "Liberation Mono" "Noto Color Emoji" "Font Awesome 6 Brands" ]; + serif = [ "NotoSans Nerd Font" "Noto Color Emoji" ]; + sansSerif = [ "Linux Biolinum O" "Noto Color Emoji" ]; + monospace = [ "Hack Nerd Font" "Noto Color Emoji" ]; }; }; }; diff --git a/hosts/common/optional/dwm.nix b/hosts/common/optional/dwm.nix index 9386358..f2d1f6e 100644 --- a/hosts/common/optional/dwm.nix +++ b/hosts/common/optional/dwm.nix @@ -1,9 +1,10 @@ { pkgs, ... }: { - services = { libinput.enable = true; xserver = { + autoRepeatDelay = 250; + autoRepeatInterval = 30; enable = true; xkb.layout = "gb"; displayManager.startx.enable = true; From a4815aa56b9386543b41860eab691cf3fad10d72 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 14 Jun 2024 21:12:38 +0100 Subject: [PATCH 13/18] added dunst vol script & moved sb scripts to dwm --- home/common/optional/desktop/dwm/default.nix | 8 ++++++- .../{status-bar => dwm/scripts}/sb-cpu-pct.sh | 0 .../{status-bar => dwm/scripts}/sb-mem-pct.sh | 0 .../scripts}/sb-network-status.sh | 0 .../{status-bar => dwm/scripts}/sb-updates.sh | 0 .../{status-bar => dwm/scripts}/sb-volume.sh | 0 .../optional/desktop/status-bar/default.nix | 10 -------- home/common/optional/desktop/x11/default.nix | 18 +++++++++++++++ .../scripts/dunstify-volume-notification.sh | 23 +++++++++++++++++++ home/semita.nix | 17 -------------- 10 files changed, 48 insertions(+), 28 deletions(-) rename home/common/optional/desktop/{status-bar => dwm/scripts}/sb-cpu-pct.sh (100%) rename home/common/optional/desktop/{status-bar => dwm/scripts}/sb-mem-pct.sh (100%) rename home/common/optional/desktop/{status-bar => dwm/scripts}/sb-network-status.sh (100%) rename home/common/optional/desktop/{status-bar => dwm/scripts}/sb-updates.sh (100%) rename home/common/optional/desktop/{status-bar => dwm/scripts}/sb-volume.sh (100%) delete mode 100644 home/common/optional/desktop/status-bar/default.nix create mode 100644 home/common/optional/desktop/x11/scripts/dunstify-volume-notification.sh diff --git a/home/common/optional/desktop/dwm/default.nix b/home/common/optional/desktop/dwm/default.nix index e0f045b..8f130e6 100644 --- a/home/common/optional/desktop/dwm/default.nix +++ b/home/common/optional/desktop/dwm/default.nix @@ -3,12 +3,18 @@ imports = [ ../common - ../status-bar ../x11 ]; home.packages = [ pkgs.dwmblocks + + # Status bar + (pkgs.writeShellScriptBin "sb-cpu-pct" (builtins.readFile ./scripts/sb-cpu-pct.sh)) + (pkgs.writeShellScriptBin "sb-mem-pct" (builtins.readFile ./scripts/sb-mem-pct.sh)) + (pkgs.writeShellScriptBin "sb-volume" (builtins.readFile ./scripts/sb-volume.sh)) + (pkgs.writeShellScriptBin "sb-network-status" (builtins.readFile ./scripts/sb-network-status.sh)) + (pkgs.writeShellScriptBin "sb-updates" (builtins.readFile ./scripts/sb-updates.sh)) ]; # TODO configure x11 to look in .config/x11 diff --git a/home/common/optional/desktop/status-bar/sb-cpu-pct.sh b/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.sh similarity index 100% rename from home/common/optional/desktop/status-bar/sb-cpu-pct.sh rename to home/common/optional/desktop/dwm/scripts/sb-cpu-pct.sh diff --git a/home/common/optional/desktop/status-bar/sb-mem-pct.sh b/home/common/optional/desktop/dwm/scripts/sb-mem-pct.sh similarity index 100% rename from home/common/optional/desktop/status-bar/sb-mem-pct.sh rename to home/common/optional/desktop/dwm/scripts/sb-mem-pct.sh diff --git a/home/common/optional/desktop/status-bar/sb-network-status.sh b/home/common/optional/desktop/dwm/scripts/sb-network-status.sh similarity index 100% rename from home/common/optional/desktop/status-bar/sb-network-status.sh rename to home/common/optional/desktop/dwm/scripts/sb-network-status.sh diff --git a/home/common/optional/desktop/status-bar/sb-updates.sh b/home/common/optional/desktop/dwm/scripts/sb-updates.sh similarity index 100% rename from home/common/optional/desktop/status-bar/sb-updates.sh rename to home/common/optional/desktop/dwm/scripts/sb-updates.sh diff --git a/home/common/optional/desktop/status-bar/sb-volume.sh b/home/common/optional/desktop/dwm/scripts/sb-volume.sh similarity index 100% rename from home/common/optional/desktop/status-bar/sb-volume.sh rename to home/common/optional/desktop/dwm/scripts/sb-volume.sh diff --git a/home/common/optional/desktop/status-bar/default.nix b/home/common/optional/desktop/status-bar/default.nix deleted file mode 100644 index 7e749cc..0000000 --- a/home/common/optional/desktop/status-bar/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = [ - (pkgs.writeShellScriptBin "sb-cpu-pct" (builtins.readFile ./sb-cpu-pct.sh)) - (pkgs.writeShellScriptBin "sb-mem-pct" (builtins.readFile ./sb-mem-pct.sh)) - (pkgs.writeShellScriptBin "sb-volume" (builtins.readFile ./sb-volume.sh)) - (pkgs.writeShellScriptBin "sb-network-status" (builtins.readFile ./sb-network-status.sh)) - (pkgs.writeShellScriptBin "sb-updates" (builtins.readFile ./sb-updates.sh)) - ]; -} diff --git a/home/common/optional/desktop/x11/default.nix b/home/common/optional/desktop/x11/default.nix index 30c936a..8273529 100644 --- a/home/common/optional/desktop/x11/default.nix +++ b/home/common/optional/desktop/x11/default.nix @@ -11,6 +11,8 @@ pkgs.dmenu pkgs.picom pkgs.xclip + + (pkgs.writeShellScriptBin "dunstify-volume-notification" (builtins.readFile ./scripts/dunstify-volume-notification.sh)) ]; home.file.".Xresources" = { @@ -41,4 +43,20 @@ fade-delta = 50; ''; }; + + home.file.".config/sxhkd/sxhkdrc" = { + recursive = true; + text = '' + vsync = true; + backend = "xrender"; + shadow = true; + shadow-radius = 10; + shadow-offset-x = -5; + shadow-offset-y = -5; + fading = true; + fade-in-step = 0.2; + fade-out-step = 0.2; + fade-delta = 50; + ''; + }; } diff --git a/home/common/optional/desktop/x11/scripts/dunstify-volume-notification.sh b/home/common/optional/desktop/x11/scripts/dunstify-volume-notification.sh new file mode 100644 index 0000000..3753329 --- /dev/null +++ b/home/common/optional/desktop/x11/scripts/dunstify-volume-notification.sh @@ -0,0 +1,23 @@ +mute_test=$(pamixer --get-mute) +mic_mute_test=$(pamixer --default-source --get-mute) + +mute="" +if [ "$mute_test" == true ]; + then + mute="(Speakers Muted)" +fi + +if [ "$mic_mute_test" == true ]; + then + mute="(Mic Muted)" +fi + +if [ "$mute_test" == true ] && [ "$mic_mute_test" == true ]; + then + mute="(Speakers Muted & Mic Muted)" +fi + +volume=$(pamixer --get-volume) + +msgTag="volume-notify" +dunstify -a "changeVolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag "Volume" "${volume} ${mute}" -t 2000 diff --git a/home/semita.nix b/home/semita.nix index 100441e..29aa52c 100644 --- a/home/semita.nix +++ b/home/semita.nix @@ -17,21 +17,4 @@ colorScheme = inputs.nix-colors.colorSchemes.kanagawa; - monitors = [ - { - name = "DP-1"; - width = 2560; - height = 1440; - refreshRate = 144; - x = 0; - primary = true; - } - { - name = "DP-2"; - width = 2560; - height = 1440; - refreshRate = 75; - x = 2560; - } - ]; } From 63874ede17e4047f2435a084cc7526ecb9e12299 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 14 Jun 2024 21:48:43 +0100 Subject: [PATCH 14/18] refactored shell scripts to nix files --- .../desktop/{ => common}/wayland/default.nix | 0 .../desktop/{ => common}/wayland/mako.nix | 0 .../wayland/swww-wallpaper-changer.nix | 0 .../desktop/{ => common}/wayland/waybar.nix | 0 .../desktop/{ => common}/x11/default.nix | 2 +- .../x11/feh-wallpaper-changer.nix | 0 .../scripts/dunstify-volume-notification.nix | 30 +++++++++++ home/common/optional/desktop/dwm/default.nix | 16 +++--- .../desktop/dwm/scripts/sb-cpu-pct.nix | 8 +++ .../desktop/dwm/scripts/sb-cpu-pct.sh | 1 - .../desktop/dwm/scripts/sb-mem-pct.nix | 9 ++++ .../desktop/dwm/scripts/sb-mem-pct.sh | 3 -- .../desktop/dwm/scripts/sb-network-status.nix | 52 +++++++++++++++++++ .../desktop/dwm/scripts/sb-network-status.sh | 43 --------------- .../desktop/dwm/scripts/sb-updates.nix | 14 +++++ .../desktop/dwm/scripts/sb-updates.sh | 6 --- .../desktop/dwm/scripts/sb-volume.nix | 49 +++++++++++++++++ .../optional/desktop/dwm/scripts/sb-volume.sh | 41 --------------- .../optional/desktop/hyprland/default.nix | 2 +- .../scripts/dunstify-volume-notification.sh | 23 -------- 20 files changed, 172 insertions(+), 127 deletions(-) rename home/common/optional/desktop/{ => common}/wayland/default.nix (100%) rename home/common/optional/desktop/{ => common}/wayland/mako.nix (100%) rename home/common/optional/desktop/{ => common}/wayland/swww-wallpaper-changer.nix (100%) rename home/common/optional/desktop/{ => common}/wayland/waybar.nix (100%) rename home/common/optional/desktop/{ => common}/x11/default.nix (90%) rename home/common/optional/desktop/{ => common}/x11/feh-wallpaper-changer.nix (100%) create mode 100644 home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix create mode 100644 home/common/optional/desktop/dwm/scripts/sb-cpu-pct.nix delete mode 100644 home/common/optional/desktop/dwm/scripts/sb-cpu-pct.sh create mode 100644 home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix delete mode 100644 home/common/optional/desktop/dwm/scripts/sb-mem-pct.sh create mode 100644 home/common/optional/desktop/dwm/scripts/sb-network-status.nix delete mode 100644 home/common/optional/desktop/dwm/scripts/sb-network-status.sh create mode 100644 home/common/optional/desktop/dwm/scripts/sb-updates.nix delete mode 100644 home/common/optional/desktop/dwm/scripts/sb-updates.sh create mode 100644 home/common/optional/desktop/dwm/scripts/sb-volume.nix delete mode 100644 home/common/optional/desktop/dwm/scripts/sb-volume.sh delete mode 100644 home/common/optional/desktop/x11/scripts/dunstify-volume-notification.sh diff --git a/home/common/optional/desktop/wayland/default.nix b/home/common/optional/desktop/common/wayland/default.nix similarity index 100% rename from home/common/optional/desktop/wayland/default.nix rename to home/common/optional/desktop/common/wayland/default.nix diff --git a/home/common/optional/desktop/wayland/mako.nix b/home/common/optional/desktop/common/wayland/mako.nix similarity index 100% rename from home/common/optional/desktop/wayland/mako.nix rename to home/common/optional/desktop/common/wayland/mako.nix diff --git a/home/common/optional/desktop/wayland/swww-wallpaper-changer.nix b/home/common/optional/desktop/common/wayland/swww-wallpaper-changer.nix similarity index 100% rename from home/common/optional/desktop/wayland/swww-wallpaper-changer.nix rename to home/common/optional/desktop/common/wayland/swww-wallpaper-changer.nix diff --git a/home/common/optional/desktop/wayland/waybar.nix b/home/common/optional/desktop/common/wayland/waybar.nix similarity index 100% rename from home/common/optional/desktop/wayland/waybar.nix rename to home/common/optional/desktop/common/wayland/waybar.nix diff --git a/home/common/optional/desktop/x11/default.nix b/home/common/optional/desktop/common/x11/default.nix similarity index 90% rename from home/common/optional/desktop/x11/default.nix rename to home/common/optional/desktop/common/x11/default.nix index 8273529..8c9fb7a 100644 --- a/home/common/optional/desktop/x11/default.nix +++ b/home/common/optional/desktop/common/x11/default.nix @@ -2,6 +2,7 @@ { imports = [ ./feh-wallpaper-changer.nix + ./scripts/dunstify-volume-notification.nix ]; home.packages = [ @@ -12,7 +13,6 @@ pkgs.picom pkgs.xclip - (pkgs.writeShellScriptBin "dunstify-volume-notification" (builtins.readFile ./scripts/dunstify-volume-notification.sh)) ]; home.file.".Xresources" = { diff --git a/home/common/optional/desktop/x11/feh-wallpaper-changer.nix b/home/common/optional/desktop/common/x11/feh-wallpaper-changer.nix similarity index 100% rename from home/common/optional/desktop/x11/feh-wallpaper-changer.nix rename to home/common/optional/desktop/common/x11/feh-wallpaper-changer.nix diff --git a/home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix b/home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix new file mode 100644 index 0000000..612e26d --- /dev/null +++ b/home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix @@ -0,0 +1,30 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "dunstify-volume-notification" '' + mute_test=$(pamixer --get-mute) + mic_mute_test=$(pamixer --default-source --get-mute) + + mute="" + if [ "$mute_test" == true ]; + then + mute="(Speakers Muted)" + fi + + if [ "$mic_mute_test" == true ]; + then + mute="(Mic Muted)" + fi + + if [ "$mute_test" == true ] && [ "$mic_mute_test" == true ]; + then + mute="(Speakers Muted & Mic Muted)" + fi + + volume=$(pamixer --get-volume) + + msgTag="volume-notify" + dunstify -a "changeVolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag "Volume" "''${volume} ''${mute}" -t 2000 + '') + ]; +} diff --git a/home/common/optional/desktop/dwm/default.nix b/home/common/optional/desktop/dwm/default.nix index 8f130e6..ee33da3 100644 --- a/home/common/optional/desktop/dwm/default.nix +++ b/home/common/optional/desktop/dwm/default.nix @@ -3,18 +3,18 @@ imports = [ ../common - ../x11 + ../common/x11 + + # Status bar scripts + ./scripts/sb-cpu-pct.nix + ./scripts/sb-mem-pct.nix + ./scripts/sb-volume.nix + ./scripts/sb-network-status.nix + ./scripts/sb-updates.nix ]; home.packages = [ pkgs.dwmblocks - - # Status bar - (pkgs.writeShellScriptBin "sb-cpu-pct" (builtins.readFile ./scripts/sb-cpu-pct.sh)) - (pkgs.writeShellScriptBin "sb-mem-pct" (builtins.readFile ./scripts/sb-mem-pct.sh)) - (pkgs.writeShellScriptBin "sb-volume" (builtins.readFile ./scripts/sb-volume.sh)) - (pkgs.writeShellScriptBin "sb-network-status" (builtins.readFile ./scripts/sb-network-status.sh)) - (pkgs.writeShellScriptBin "sb-updates" (builtins.readFile ./scripts/sb-updates.sh)) ]; # TODO configure x11 to look in .config/x11 diff --git a/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.nix b/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.nix new file mode 100644 index 0000000..b2117a0 --- /dev/null +++ b/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "sb-cpu-pct" '' + echo $(top -bn 1 |grep "Cpu(s)" | awk '{print $2+$6 "%"}' | sed "s/\..//g") + '') + ]; +} diff --git a/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.sh b/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.sh deleted file mode 100644 index ab61fb9..0000000 --- a/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.sh +++ /dev/null @@ -1 +0,0 @@ -echo $(top -bn 1 |grep "Cpu(s)" | awk '{print $2+$6 "%"}' | sed "s/\..//g") diff --git a/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix b/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix new file mode 100644 index 0000000..780afe1 --- /dev/null +++ b/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "sb-mem-pct" '' + # Gets current ram percent utilisation + echo $(free | awk '/^Mem/ {print "100*" $3 " / " $2 }' | bc | awk '{print $1"%"}') + '') + ]; +} diff --git a/home/common/optional/desktop/dwm/scripts/sb-mem-pct.sh b/home/common/optional/desktop/dwm/scripts/sb-mem-pct.sh deleted file mode 100644 index 158d95b..0000000 --- a/home/common/optional/desktop/dwm/scripts/sb-mem-pct.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Gets current ram percent utilisation - -echo $(free | awk '/^Mem/ {print "100*" $3 " / " $2 }' | bc | awk '{print $1"%"}') diff --git a/home/common/optional/desktop/dwm/scripts/sb-network-status.nix b/home/common/optional/desktop/dwm/scripts/sb-network-status.nix new file mode 100644 index 0000000..9ce8a4a --- /dev/null +++ b/home/common/optional/desktop/dwm/scripts/sb-network-status.nix @@ -0,0 +1,52 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "sb-network-status" '' + # Nerd Font Symbols + wifi_symbol=" " + lan_symbol="󰌗 " + disconnected_symbol="󰲜 " + vpn_symbol="󰖂 " + internet="󰞉 " + internet_disconnected="󰪎 " + + # Get the network status + DEFAULT_INTERFACE=$(ip route | grep '^default' | awk '{print $5}' | uniq) + IP_ADDRESS=$(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p') + + if [ -z "$DEFAULT_INTERFACE" ]; then + network_symbol="$disconnected_symbol" + else + # Check if it is a wireless interface (wlan*) + if [[ $DEFAULT_INTERFACE == wl* ]]; then + network_symbol="$wifi_symbol" + else + network_symbol="$lan_symbol" + fi + fi + + # Check internet connectivity + if ! ping -c 1 8.8.8.8 &> /dev/null; + then + network_symbol="$network_symbol $internet_disconnected" + else + network_symbol="$network_symbol $internet" + fi + + if ip addr show tun0 > /dev/null 2>&1; then + network_symbol="$network_symbol $vpn_symbol" + else + network_symbol="$network_symbol" + fi + + if [ -z "$IP_ADDRESS" ]; + then + printf "$network_symbol" + else + printf "$network_symbol|$IP_ADDRESS" + fi + '') + ]; +} + + diff --git a/home/common/optional/desktop/dwm/scripts/sb-network-status.sh b/home/common/optional/desktop/dwm/scripts/sb-network-status.sh deleted file mode 100644 index d8e09ef..0000000 --- a/home/common/optional/desktop/dwm/scripts/sb-network-status.sh +++ /dev/null @@ -1,43 +0,0 @@ -# Nerd Font Symbols -wifi_symbol=" " -lan_symbol="󰌗 " -disconnected_symbol="󰲜 " -vpn_symbol="󰖂 " -internet="󰞉 " -internet_disconnected="󰪎 " - -# Get the network status -DEFAULT_INTERFACE=$(ip route | grep '^default' | awk '{print $5}' | uniq) -IP_ADDRESS=$(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p') - -if [ -z "$DEFAULT_INTERFACE" ]; then - network_symbol="$disconnected_symbol" -else - # Check if it is a wireless interface (wlan*) - if [[ $DEFAULT_INTERFACE == wl* ]]; then - network_symbol="$wifi_symbol" - else - network_symbol="$lan_symbol" - fi -fi - -# Check internet connectivity -if ! ping -c 1 8.8.8.8 &> /dev/null; -then - network_symbol="$network_symbol $internet_disconnected" -else - network_symbol="$network_symbol $internet" -fi - -if ip addr show tun0 > /dev/null 2>&1; then - network_symbol="$network_symbol $vpn_symbol" -else - network_symbol="$network_symbol" -fi - -if [ -z "$IP_ADDRESS" ]; -then - printf "$network_symbol" -else -printf "$network_symbol|$IP_ADDRESS" -fi diff --git a/home/common/optional/desktop/dwm/scripts/sb-updates.nix b/home/common/optional/desktop/dwm/scripts/sb-updates.nix new file mode 100644 index 0000000..e20b521 --- /dev/null +++ b/home/common/optional/desktop/dwm/scripts/sb-updates.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "sb-updates" '' + # Gets number of flake inputs that are ready for update + # Checks every 60 minutes + inputs=$(cd /etc/nixos && + nix flake update --output-lock-file <(cat flake.nix) 2> /tmp/update && + cat /tmp/update | grep -c Update) + printf " $inputs" + '') + ]; +} + diff --git a/home/common/optional/desktop/dwm/scripts/sb-updates.sh b/home/common/optional/desktop/dwm/scripts/sb-updates.sh deleted file mode 100644 index 80bb055..0000000 --- a/home/common/optional/desktop/dwm/scripts/sb-updates.sh +++ /dev/null @@ -1,6 +0,0 @@ -# Gets number of flake inputs that are ready for update -# Checks every 60 minutes -inputs=$(cd /etc/nixos && - nix flake update --output-lock-file <(cat flake.nix) 2> /tmp/update && - cat /tmp/update | grep -c Update) -printf " $inputs" diff --git a/home/common/optional/desktop/dwm/scripts/sb-volume.nix b/home/common/optional/desktop/dwm/scripts/sb-volume.nix new file mode 100644 index 0000000..6d69509 --- /dev/null +++ b/home/common/optional/desktop/dwm/scripts/sb-volume.nix @@ -0,0 +1,49 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "sb-volume" '' + # Prints the current volume or 婢 if muted. + + case $BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e pulsemixer ;; + 2) pamixer -t && pkill -RTMIN+10 dwmblocks && exit 1 ;; + 4) pamixer --set-limit 150 --allow-boost -i 1 && pkill -RTMIN+10 dwmblocks && exit 1 ;; + 5) pamixer --set-limit 150 --allow-boost -d 1 && pkill -RTMIN+10 dwmblocks && exit 1 ;; + 3) notify-send "Volume module" "\- Shows volume , 婢 if muted. + - Middle click to mute. + - Scroll to change." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + esac + + get_mic_status=$(pamixer --default-source --get-mute) + vol="$(pamixer --get-volume)" + + if [ $get_mic_status == false ]; then + mic_status="" + else + mic_status="" + fi + + if [ "$vol" -gt "90" ]; then + icon="" + elif [ "$vol" -gt "50" ]; then + icon="󰕾" + elif [ "$vol" -gt "30" ]; then + icon="" + elif [ "$vol" -gt "0" ]; then + icon="󰕿" + else + icon="󰝟" + fi + + if [ $(pamixer --get-mute) = true ]; then + icon="󰸈" + vol="0" + fi + + print_string="$mic_status $icon $vol%" + printf '%s' "''${print_string}" + '') + ]; +} + diff --git a/home/common/optional/desktop/dwm/scripts/sb-volume.sh b/home/common/optional/desktop/dwm/scripts/sb-volume.sh deleted file mode 100644 index 1da6af3..0000000 --- a/home/common/optional/desktop/dwm/scripts/sb-volume.sh +++ /dev/null @@ -1,41 +0,0 @@ -# Prints the current volume or 婢 if muted. - -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e pulsemixer ;; - 2) pamixer -t && pkill -RTMIN+10 dwmblocks && exit 1 ;; - 4) pamixer --set-limit 150 --allow-boost -i 1 && pkill -RTMIN+10 dwmblocks && exit 1 ;; - 5) pamixer --set-limit 150 --allow-boost -d 1 && pkill -RTMIN+10 dwmblocks && exit 1 ;; - 3) notify-send "Volume module" "\- Shows volume , 婢 if muted. -- Middle click to mute. -- Scroll to change." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -get_mic_status=$(pamixer --default-source --get-mute) -vol="$(pamixer --get-volume)" - -if [ $get_mic_status == false ]; then - mic_status="" -else - mic_status="" -fi - -if [ "$vol" -gt "90" ]; then - icon="" -elif [ "$vol" -gt "50" ]; then - icon="󰕾" -elif [ "$vol" -gt "30" ]; then - icon="" -elif [ "$vol" -gt "0" ]; then - icon="󰕿" -else - icon="󰝟" -fi - -if [ $(pamixer --get-mute) = true ]; then - icon="󰸈" - vol="0" -fi - -print_string="$mic_status $icon $vol%" -printf '%s' "${print_string}" diff --git a/home/common/optional/desktop/hyprland/default.nix b/home/common/optional/desktop/hyprland/default.nix index eac93c1..dd0c11e 100644 --- a/home/common/optional/desktop/hyprland/default.nix +++ b/home/common/optional/desktop/hyprland/default.nix @@ -5,7 +5,7 @@ imports = [ ../common - ../wayland + ../common/wayland ./pyprland.nix ]; wayland.windowManager.hyprland = { diff --git a/home/common/optional/desktop/x11/scripts/dunstify-volume-notification.sh b/home/common/optional/desktop/x11/scripts/dunstify-volume-notification.sh deleted file mode 100644 index 3753329..0000000 --- a/home/common/optional/desktop/x11/scripts/dunstify-volume-notification.sh +++ /dev/null @@ -1,23 +0,0 @@ -mute_test=$(pamixer --get-mute) -mic_mute_test=$(pamixer --default-source --get-mute) - -mute="" -if [ "$mute_test" == true ]; - then - mute="(Speakers Muted)" -fi - -if [ "$mic_mute_test" == true ]; - then - mute="(Mic Muted)" -fi - -if [ "$mute_test" == true ] && [ "$mic_mute_test" == true ]; - then - mute="(Speakers Muted & Mic Muted)" -fi - -volume=$(pamixer --get-volume) - -msgTag="volume-notify" -dunstify -a "changeVolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag "Volume" "${volume} ${mute}" -t 2000 From c4a76219c9f99dc5f4dd746ce76672597dd01633 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 14 Jun 2024 22:00:56 +0100 Subject: [PATCH 15/18] call nix packages in script --- .../scripts/dunstify-volume-notification.nix | 8 ++++---- .../desktop/dwm/scripts/sb-mem-pct.nix | 2 +- .../optional/desktop/dwm/scripts/sb-volume.nix | 18 +++--------------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix b/home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix index 612e26d..92b0905 100644 --- a/home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix +++ b/home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix @@ -2,8 +2,8 @@ { home.packages = with pkgs; [ (writeShellScriptBin "dunstify-volume-notification" '' - mute_test=$(pamixer --get-mute) - mic_mute_test=$(pamixer --default-source --get-mute) + mute_test=$(${pamixer}/bin/pamixer --get-mute) + mic_mute_test=$(${pamixer}/bin/pamixer --default-source --get-mute) mute="" if [ "$mute_test" == true ]; @@ -21,10 +21,10 @@ mute="(Speakers Muted & Mic Muted)" fi - volume=$(pamixer --get-volume) + volume=$(${pamixer}/bin/pamixer --get-volume) msgTag="volume-notify" - dunstify -a "changeVolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag "Volume" "''${volume} ''${mute}" -t 2000 + ${dunst}/bin/dunstify -a "changeVolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag "Volume" "''${volume} ''${mute}" -t 2000 '') ]; } diff --git a/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix b/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix index 780afe1..453e807 100644 --- a/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix +++ b/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix @@ -3,7 +3,7 @@ home.packages = with pkgs; [ (writeShellScriptBin "sb-mem-pct" '' # Gets current ram percent utilisation - echo $(free | awk '/^Mem/ {print "100*" $3 " / " $2 }' | bc | awk '{print $1"%"}') + echo $(free | awk '/^Mem/ {print "100*" $3 " / " $2 }' | ${bc}/bin/bc | awk '{print $1"%"}') '') ]; } diff --git a/home/common/optional/desktop/dwm/scripts/sb-volume.nix b/home/common/optional/desktop/dwm/scripts/sb-volume.nix index 6d69509..99e2e45 100644 --- a/home/common/optional/desktop/dwm/scripts/sb-volume.nix +++ b/home/common/optional/desktop/dwm/scripts/sb-volume.nix @@ -3,20 +3,8 @@ home.packages = with pkgs; [ (writeShellScriptBin "sb-volume" '' # Prints the current volume or 婢 if muted. - - case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e pulsemixer ;; - 2) pamixer -t && pkill -RTMIN+10 dwmblocks && exit 1 ;; - 4) pamixer --set-limit 150 --allow-boost -i 1 && pkill -RTMIN+10 dwmblocks && exit 1 ;; - 5) pamixer --set-limit 150 --allow-boost -d 1 && pkill -RTMIN+10 dwmblocks && exit 1 ;; - 3) notify-send "Volume module" "\- Shows volume , 婢 if muted. - - Middle click to mute. - - Scroll to change." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; - esac - - get_mic_status=$(pamixer --default-source --get-mute) - vol="$(pamixer --get-volume)" + get_mic_status=$(${pamixer}/bin/pamixer --default-source --get-mute) + vol="$(${pamixer}/bin/pamixer --get-volume)" if [ $get_mic_status == false ]; then mic_status="" @@ -36,7 +24,7 @@ icon="󰝟" fi - if [ $(pamixer --get-mute) = true ]; then + if [ $(${pamixer}/bin/pamixer --get-mute) = true ]; then icon="󰸈" vol="0" fi From 1d61c343d1442b7e2c3c836d0a8c6934cbfcf11f Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 15 Jun 2024 00:50:30 +0100 Subject: [PATCH 16/18] libqalculate --- flake.lock | 168 ++++++++++++++++++++++++++++++----- home/common/core/default.nix | 2 +- overlays/default.nix | 2 +- pkgs/default.nix | 2 - pkgs/sqlfmt/default.nix | 24 +++++ 5 files changed, 174 insertions(+), 24 deletions(-) create mode 100644 pkgs/sqlfmt/default.nix diff --git a/flake.lock b/flake.lock index 042f860..c2e92b2 100644 --- a/flake.lock +++ b/flake.lock @@ -147,7 +147,25 @@ }, "flake-utils_3": { "inputs": { - "systems": "systems_3" + "systems": "systems_4" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "inputs": { + "systems": "systems_5" }, "locked": { "lastModified": 1710146030, @@ -309,6 +327,27 @@ } }, "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703863825, + "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix-github-actions_2": { "inputs": { "nixpkgs": [ "sqlfmt", @@ -391,11 +430,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1718160348, - "narHash": "sha256-9YrUjdztqi4Gz8n3mBuqvCkMo4ojrA6nASwyIKWMpus=", + "lastModified": 1718318537, + "narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "57d6973abba7ea108bac64ae7629e7431e0199b6", + "rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420", "type": "github" }, "original": { @@ -407,11 +446,27 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1718267761, - "narHash": "sha256-cNvy96/8JSSAQ7/o10ZzQSr+AUelhW4pcNPPYDbhS9o=", + "lastModified": 1717926692, + "narHash": "sha256-THcv8qDqobZefHHluPjx/8n+MtVVb8ag/oJbKMqKNRo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "21d22ef2ea511a82e20654d20ed493cef5690084", + "rev": "7d916e720af6b2ca355e4d0cfb8e4f742c172239", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1718376599, + "narHash": "sha256-cTFGqLYTrIxORc673fUUCecQVXiXHDj6Z8vFQ5K4SDg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3bac01780f87646b70326db70920902bc4d49fab", "type": "github" }, "original": { @@ -435,11 +490,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1718290136, - "narHash": "sha256-BQFspZqwA56LOIQ0ypw54Nal/BLFUpnZTqoXxeiSTNE=", + "lastModified": 1718376125, + "narHash": "sha256-NIJZxmY2CWsqJK/9BQCRSHfcCY9K6thjq/1XtJobxmU=", "owner": "nix-community", "repo": "nixvim", - "rev": "80c03843e7ad7fc7deb0dce6d1f6fc45593ed91d", + "rev": "7a2a25af02be25987aa43cd681312f4b5ba12317", "type": "github" }, "original": { @@ -450,11 +505,11 @@ }, "nur": { "locked": { - "lastModified": 1718310343, - "narHash": "sha256-jD2XqvofA5hdROv8OSTss/vjJi164Mjavgh2yJf2ej4=", + "lastModified": 1718398470, + "narHash": "sha256-47JT0Za+js92ci0GhStCY21UiEB3MU4cBYoCVmpfudA=", "owner": "nix-community", "repo": "NUR", - "rev": "ca312c14ad9abbb8736b9f9fd6fa8b8f60b2f1b2", + "rev": "c6325c8dee7dd1f58e1b4884672c670d6b541845", "type": "github" }, "original": { @@ -465,14 +520,36 @@ }, "poetry2nix": { "inputs": { - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_2", "nix-github-actions": "nix-github-actions", + "nixpkgs": "nixpkgs_2", + "systems": "systems_3", + "treefmt-nix": "treefmt-nix_2" + }, + "locked": { + "lastModified": 1718285706, + "narHash": "sha256-DScsBM+kZvxOva7QegfdtleebMXh30XPxDQr/1IGKYo=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "a5be1bbbe0af0266147a88e0ec43b18c722f2bb9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, + "poetry2nix_2": { + "inputs": { + "flake-utils": "flake-utils_4", + "nix-github-actions": "nix-github-actions_2", "nixpkgs": [ "sqlfmt", "nixpkgs" ], - "systems": "systems_4", - "treefmt-nix": "treefmt-nix_2" + "systems": "systems_6", + "treefmt-nix": "treefmt-nix_3" }, "locked": { "lastModified": 1718285706, @@ -499,6 +576,7 @@ "nixpkgs-unstable": "nixpkgs-unstable", "nixvim": "nixvim", "nur": "nur", + "poetry2nix": "poetry2nix", "sops-nix": "sops-nix", "sqlfmt": "sqlfmt" } @@ -526,9 +604,9 @@ }, "sqlfmt": { "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_2", - "poetry2nix": "poetry2nix" + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_3", + "poetry2nix": "poetry2nix_2" }, "locked": { "dir": "sqlfmt", @@ -577,6 +655,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=", @@ -591,7 +683,22 @@ "type": "github" } }, - "systems_4": { + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_6": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -627,6 +734,27 @@ } }, "treefmt-nix_2": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717850719, + "narHash": "sha256-npYqVg+Wk4oxnWrnVG7416fpfrlRhp/lQ6wQ4DHI8YE=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "4fc1c45a5f50169f9f29f6a98a438fb910b834ed", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_3": { "inputs": { "nixpkgs": [ "sqlfmt", diff --git a/home/common/core/default.nix b/home/common/core/default.nix index 96d29e5..1c10ec6 100644 --- a/home/common/core/default.nix +++ b/home/common/core/default.nix @@ -25,7 +25,7 @@ btop htop postgresql - bc + libqalculate ; }; home.stateVersion = "23.11"; diff --git a/overlays/default.nix b/overlays/default.nix index 7bfcb4c..a1f5ca6 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,5 +1,5 @@ # This file defines overlays -{inputs, ...}: { +{ inputs, ... }: { # This one brings our custom packages from the 'pkgs' directory additions = final: _prev: import ../pkgs final.pkgs; diff --git a/pkgs/default.nix b/pkgs/default.nix index 5c3ecc4..1ef4e77 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,5 +1,3 @@ -# Custom packages, that can be defined similarly to ones from nixpkgs -# You can build them using 'nix build .#example' pkgs: { sddm-theme = pkgs.callPackage ./sddm-theme { }; st = pkgs.callPackage ./st { }; diff --git a/pkgs/sqlfmt/default.nix b/pkgs/sqlfmt/default.nix new file mode 100644 index 0000000..e2c0f92 --- /dev/null +++ b/pkgs/sqlfmt/default.nix @@ -0,0 +1,24 @@ +{ pkgs ? import { } +, ... +}: + +let + name = "hello_poetry2nix"; + rev = "4431812218e1963fd34f4d9d22dcd688a4c33fb4"; + hash = "sha256-iHqzA/HJ+vb7O5vpGpA1eR3BcoGDPE2QOqQQpOp0zFQ="; + + src = pkgs.fetchFromGitHub { + inherit rev hash; + + owner = "wilsonehusin"; + repo = "hello-poetry2nix"; + }; +in +pkgs.poetry2nix.mkPoetryApplication { + inherit name src; + + pname = name; + version = rev; + projectDir = src; +} + From 75cdf136e3101f1f8afff41a0864e737937d8f1f Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 15 Jun 2024 01:20:42 +0100 Subject: [PATCH 17/18] modularise dwm --- flake.lock | 148 ++---------------- .../optional/desktop/cinnamon/autostart.nix | 0 .../optional/desktop/cinnamon/default.nix | 2 + .../optional/desktop/common/x11/default.nix | 52 +----- .../{ => scripts}/feh-wallpaper-changer.nix | 0 home/common/optional/desktop/dwm/default.nix | 44 ++---- home/common/optional/desktop/dwm/picom.nix | 17 ++ .../scripts/dunstify-volume-notification.nix | 0 home/common/optional/desktop/dwm/sxhkdrc.nix | 48 ++++++ home/common/optional/desktop/dwm/xinitrc.nix | 32 ++++ .../optional/desktop/dwm/xresources.nix | 14 ++ hosts/common/optional/pipewire.nix | 28 ++-- 12 files changed, 150 insertions(+), 235 deletions(-) create mode 100644 home/common/optional/desktop/cinnamon/autostart.nix rename home/common/optional/desktop/common/x11/{ => scripts}/feh-wallpaper-changer.nix (100%) create mode 100644 home/common/optional/desktop/dwm/picom.nix rename home/common/optional/desktop/{common/x11 => dwm}/scripts/dunstify-volume-notification.nix (100%) create mode 100644 home/common/optional/desktop/dwm/sxhkdrc.nix create mode 100644 home/common/optional/desktop/dwm/xinitrc.nix create mode 100644 home/common/optional/desktop/dwm/xresources.nix diff --git a/flake.lock b/flake.lock index c2e92b2..c32bfea 100644 --- a/flake.lock +++ b/flake.lock @@ -147,25 +147,7 @@ }, "flake-utils_3": { "inputs": { - "systems": "systems_4" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_4": { - "inputs": { - "systems": "systems_5" + "systems": "systems_3" }, "locked": { "lastModified": 1710146030, @@ -327,27 +309,6 @@ } }, "nix-github-actions": { - "inputs": { - "nixpkgs": [ - "poetry2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1703863825, - "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", - "owner": "nix-community", - "repo": "nix-github-actions", - "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-github-actions", - "type": "github" - } - }, - "nix-github-actions_2": { "inputs": { "nixpkgs": [ "sqlfmt", @@ -445,22 +406,6 @@ } }, "nixpkgs_2": { - "locked": { - "lastModified": 1717926692, - "narHash": "sha256-THcv8qDqobZefHHluPjx/8n+MtVVb8ag/oJbKMqKNRo=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "7d916e720af6b2ca355e4d0cfb8e4f742c172239", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable-small", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1718376599, "narHash": "sha256-cTFGqLYTrIxORc673fUUCecQVXiXHDj6Z8vFQ5K4SDg=", @@ -520,36 +465,14 @@ }, "poetry2nix": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "nix-github-actions": "nix-github-actions", - "nixpkgs": "nixpkgs_2", - "systems": "systems_3", - "treefmt-nix": "treefmt-nix_2" - }, - "locked": { - "lastModified": 1718285706, - "narHash": "sha256-DScsBM+kZvxOva7QegfdtleebMXh30XPxDQr/1IGKYo=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "a5be1bbbe0af0266147a88e0ec43b18c722f2bb9", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "poetry2nix", - "type": "github" - } - }, - "poetry2nix_2": { - "inputs": { - "flake-utils": "flake-utils_4", - "nix-github-actions": "nix-github-actions_2", "nixpkgs": [ "sqlfmt", "nixpkgs" ], - "systems": "systems_6", - "treefmt-nix": "treefmt-nix_3" + "systems": "systems_4", + "treefmt-nix": "treefmt-nix_2" }, "locked": { "lastModified": 1718285706, @@ -576,7 +499,6 @@ "nixpkgs-unstable": "nixpkgs-unstable", "nixvim": "nixvim", "nur": "nur", - "poetry2nix": "poetry2nix", "sops-nix": "sops-nix", "sqlfmt": "sqlfmt" } @@ -604,9 +526,9 @@ }, "sqlfmt": { "inputs": { - "flake-utils": "flake-utils_3", - "nixpkgs": "nixpkgs_3", - "poetry2nix": "poetry2nix_2" + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2", + "poetry2nix": "poetry2nix" }, "locked": { "dir": "sqlfmt", @@ -664,41 +586,12 @@ "type": "github" }, "original": { - "id": "systems", - "type": "indirect" + "owner": "nix-systems", + "repo": "default", + "type": "github" } }, "systems_4": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_5": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_6": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -734,27 +627,6 @@ } }, "treefmt-nix_2": { - "inputs": { - "nixpkgs": [ - "poetry2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1717850719, - "narHash": "sha256-npYqVg+Wk4oxnWrnVG7416fpfrlRhp/lQ6wQ4DHI8YE=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "4fc1c45a5f50169f9f29f6a98a438fb910b834ed", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, - "treefmt-nix_3": { "inputs": { "nixpkgs": [ "sqlfmt", diff --git a/home/common/optional/desktop/cinnamon/autostart.nix b/home/common/optional/desktop/cinnamon/autostart.nix new file mode 100644 index 0000000..e69de29 diff --git a/home/common/optional/desktop/cinnamon/default.nix b/home/common/optional/desktop/cinnamon/default.nix index b46cc7d..092d169 100644 --- a/home/common/optional/desktop/cinnamon/default.nix +++ b/home/common/optional/desktop/cinnamon/default.nix @@ -1,6 +1,8 @@ { imports = [ ../common + ../common/x11 + ./autostart.nix # This doesn't seem to work in Cinnamon #./cinnamon-monitors.nix ]; diff --git a/home/common/optional/desktop/common/x11/default.nix b/home/common/optional/desktop/common/x11/default.nix index 8c9fb7a..c59cb66 100644 --- a/home/common/optional/desktop/common/x11/default.nix +++ b/home/common/optional/desktop/common/x11/default.nix @@ -1,62 +1,14 @@ { pkgs, ... }: { imports = [ - ./feh-wallpaper-changer.nix - ./scripts/dunstify-volume-notification.nix + ./scripts/feh-wallpaper-changer.nix ]; home.packages = [ - pkgs.dunst pkgs.flameshot pkgs.st - pkgs.dmenu - pkgs.picom pkgs.xclip - + pkgs.feh ]; - home.file.".Xresources" = { - recursive = true; - text = '' - !st terminal - st.alpha: 0.8 - *.font: monospace:pixelsize=21:antialias=true:autohint=true; - *.font2: NotoColorEmoji:pixelsize=19:antialias=true:autohint=true; - - ! dwm - dwm.borderpx: 3 - ''; - }; - - home.file.".config/picom/picom.conf" = { - recursive = true; - text = '' - vsync = true; - backend = "xrender"; - shadow = true; - shadow-radius = 10; - shadow-offset-x = -5; - shadow-offset-y = -5; - fading = true; - fade-in-step = 0.2; - fade-out-step = 0.2; - fade-delta = 50; - ''; - }; - - home.file.".config/sxhkd/sxhkdrc" = { - recursive = true; - text = '' - vsync = true; - backend = "xrender"; - shadow = true; - shadow-radius = 10; - shadow-offset-x = -5; - shadow-offset-y = -5; - fading = true; - fade-in-step = 0.2; - fade-out-step = 0.2; - fade-delta = 50; - ''; - }; } diff --git a/home/common/optional/desktop/common/x11/feh-wallpaper-changer.nix b/home/common/optional/desktop/common/x11/scripts/feh-wallpaper-changer.nix similarity index 100% rename from home/common/optional/desktop/common/x11/feh-wallpaper-changer.nix rename to home/common/optional/desktop/common/x11/scripts/feh-wallpaper-changer.nix diff --git a/home/common/optional/desktop/dwm/default.nix b/home/common/optional/desktop/dwm/default.nix index ee33da3..c27b85d 100644 --- a/home/common/optional/desktop/dwm/default.nix +++ b/home/common/optional/desktop/dwm/default.nix @@ -4,6 +4,10 @@ imports = [ ../common ../common/x11 + ./xinitrc.nix + ./sxhkdrc.nix + ./picom.nix + ./xresources.nix # Status bar scripts ./scripts/sb-cpu-pct.nix @@ -11,42 +15,16 @@ ./scripts/sb-volume.nix ./scripts/sb-network-status.nix ./scripts/sb-updates.nix + + # Notification scripts + ./scripts/dunstify-volume-notification.nix ]; home.packages = [ pkgs.dwmblocks + pkgs.dmenu + pkgs.dunst + pkgs.picom + pkgs.sxhkd ]; - - # TODO configure x11 to look in .config/x11 - #home.file."${config.xdg.configHome}/x11/xinitrc" = { - home.file.".xinitrc" = { - recursive = true; - text = '' - - picom -b --config ~/.config/picom/picom.conf - xrdb ~/.Xresources - - autostart="dwmblocks feh-wallpaper-changer" - - for program in $autostart; do - pidof -sx "$program" || "$program" & - done >/dev/null 2>&1 - - - if test -z "$DBUS_SESSION_BUS_ADDRESS"; then - eval $(dbus-launch --exit-with-session --sh-syntax) - fi - systemctl --user import-environment DISPLAY XAUTHORITY - - if command -v dbus-update-activation-environment >/dev/null 2>&1; then - dbus-update-activation-environment DISPLAY XAUTHORITY - fi - - export XSESSION_PID="$$" - exec dwm - - ''; - }; - - } diff --git a/home/common/optional/desktop/dwm/picom.nix b/home/common/optional/desktop/dwm/picom.nix new file mode 100644 index 0000000..e395d7b --- /dev/null +++ b/home/common/optional/desktop/dwm/picom.nix @@ -0,0 +1,17 @@ +{ + home.file.".config/picom/picom.conf" = { + recursive = true; + text = '' + vsync = true; + backend = "xrender"; + shadow = true; + shadow-radius = 10; + shadow-offset-x = -5; + shadow-offset-y = -5; + fading = true; + fade-in-step = 0.2; + fade-out-step = 0.2; + fade-delta = 50; + ''; + }; +} diff --git a/home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix b/home/common/optional/desktop/dwm/scripts/dunstify-volume-notification.nix similarity index 100% rename from home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix rename to home/common/optional/desktop/dwm/scripts/dunstify-volume-notification.nix diff --git a/home/common/optional/desktop/dwm/sxhkdrc.nix b/home/common/optional/desktop/dwm/sxhkdrc.nix new file mode 100644 index 0000000..1b60de5 --- /dev/null +++ b/home/common/optional/desktop/dwm/sxhkdrc.nix @@ -0,0 +1,48 @@ +{ + home.file.".config/sxhkd/sxhkdrc" = { + recursive = true; + text = '' + XF86AudioRaiseVolume + pamixer --set-limit 150 --allow-boost -i 5 && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1 + + XF86AudioLowerVolume + pamixer --set-limit 150 --allow-boost -d 5 && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1 + + XF86AudioMute + pamixer --toggle-mute && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1 + + XF86AudioMicMute + pamixer --default-source --toggle-mute && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1 + + XF86MonBrightnessUp + light -A 5 && dunstify-brightness-notification + + XF86MonBrightnessDown + light -U 5 && dunstify-brightness-notification + + XF86Messenger + dunstify-battery-notification + + control + Home + bookmark-add + + control + Insert + bookmark-insert + + control + F12 + nsxiv-clipboard-copy /tmp/clipboard/images/ + + Print + flameshot gui + + control + F11 + dmenu-clipper + + control + F8 + dmenu-dict + + control + F7 + emoji-picker + ''; + }; +} diff --git a/home/common/optional/desktop/dwm/xinitrc.nix b/home/common/optional/desktop/dwm/xinitrc.nix new file mode 100644 index 0000000..51ee978 --- /dev/null +++ b/home/common/optional/desktop/dwm/xinitrc.nix @@ -0,0 +1,32 @@ +{ + # TODO configure x11 to look in .config/x11 + #home.file."${config.xdg.configHome}/x11/xinitrc" = { + home.file.".xinitrc" = { + recursive = true; + text = '' + + picom -b --config ~/.config/picom/picom.conf + xrdb ~/.Xresources + + autostart="dwmblocks feh-wallpaper-changer" + + for program in $autostart; do + pidof -sx "$program" || "$program" & + done >/dev/null 2>&1 + + + if test -z "$DBUS_SESSION_BUS_ADDRESS"; then + eval $(dbus-launch --exit-with-session --sh-syntax) + fi + systemctl --user import-environment DISPLAY XAUTHORITY + + if command -v dbus-update-activation-environment >/dev/null 2>&1; then + dbus-update-activation-environment DISPLAY XAUTHORITY + fi + + export XSESSION_PID="$$" + exec dwm + + ''; + }; +} diff --git a/home/common/optional/desktop/dwm/xresources.nix b/home/common/optional/desktop/dwm/xresources.nix new file mode 100644 index 0000000..df23d70 --- /dev/null +++ b/home/common/optional/desktop/dwm/xresources.nix @@ -0,0 +1,14 @@ +{ + home.file.".Xresources" = { + recursive = true; + text = '' + !st terminal + st.alpha: 0.8 + *.font: monospace:pixelsize=21:antialias=true:autohint=true; + *.font2: NotoColorEmoji:pixelsize=19:antialias=true:autohint=true; + + ! dwm + dwm.borderpx: 3 + ''; + }; +} diff --git a/hosts/common/optional/pipewire.nix b/hosts/common/optional/pipewire.nix index 26948ee..70b8fe6 100644 --- a/hosts/common/optional/pipewire.nix +++ b/hosts/common/optional/pipewire.nix @@ -1,21 +1,21 @@ { pkgs, ... }: { sound.enable = true; - hardware.pulseaudio.enable = true; + #hardware.pulseaudio.enable = true; security.rtkit.enable = true; - hardware.pulseaudio.package = pkgs.pulseaudioFull; -# services.pipewire = { -# enable = true; -# alsa.enable = true; -# alsa.support32Bit = true; -# pulse.enable = true; -# wireplumber.enable = true; -# jack.enable = true; -# -# }; + #hardware.pulseaudio.package = pkgs.pulseaudioFull; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + wireplumber.enable = true; + jack.enable = true; -environment.systemPackages = [ - pkgs.pamixer - pkgs.pavucontrol + }; + + environment.systemPackages = [ + pkgs.pamixer + pkgs.pavucontrol ]; } From 9ea47f60575d657efb1b17b6c1ff66781abfcd38 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 15 Jun 2024 01:28:33 +0100 Subject: [PATCH 18/18] cinnamon wallpaper changer --- .../optional/desktop/cinnamon/autostart.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/home/common/optional/desktop/cinnamon/autostart.nix b/home/common/optional/desktop/cinnamon/autostart.nix index e69de29..9230a70 100644 --- a/home/common/optional/desktop/cinnamon/autostart.nix +++ b/home/common/optional/desktop/cinnamon/autostart.nix @@ -0,0 +1,16 @@ +{ + home.file.".config/autostart/feh-wallpaper-changer.desktop" = { + recursive = true; + text = '' + [ Desktop Entry ] + Type=Application + Exec=feh-wallpaper-changer + X-GNOME-Autostart-enabled=true + NoDisplay=false + Hidden=false + Name[en_GB]=feh-wallpaper-changer + Comment[en_GB]=Periodically changes the wallpaper using feh + X-GNOME-Autostart-Delay=0 + ''; + }; +}