diff --git a/flake.lock b/flake.lock index dd3dff6..39a6542 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,119 @@ { "nodes": { + "anyrun": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1735301051, + "narHash": "sha256-jU88Q9tP4vuvWYGQcmOdFwI9e2uMPVYJHbXdiklIH9o=", + "owner": "anyrun-org", + "repo": "anyrun", + "rev": "06017e753c8886d5296768dca80745ee09402a2d", + "type": "github" + }, + "original": { + "owner": "anyrun-org", + "repo": "anyrun", + "type": "github" + } + }, + "aquamarine": { + "inputs": { + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "hyprwayland-scanner": [ + "hyprland", + "hyprwayland-scanner" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1736102453, + "narHash": "sha256-5qb4kb7Xbt8jJFL/oDqOor9Z2+E+A+ql3PiyDvsfWZ0=", + "owner": "hyprwm", + "repo": "aquamarine", + "rev": "4846091641f3be0ad7542086d52769bb7932bde6", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "aquamarine", + "type": "github" + } + }, + "flake-compat": { + "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": [ + "anyrun", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "hyprland", + "pre-commit-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": [ @@ -21,6 +135,256 @@ "type": "github" } }, + "hyprcursor": { + "inputs": { + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1734906540, + "narHash": "sha256-vQ/L9hZFezC0LquLo4TWXkyniWtYBlFHAKIsDc7PYJE=", + "owner": "hyprwm", + "repo": "hyprcursor", + "rev": "69270ba8f057d55b0e6c2dca0e165d652856e613", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprgraphics": { + "inputs": { + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1736115290, + "narHash": "sha256-Jcn6yAzfUMcxy3tN/iZRbi/QgrYm7XLyVRl9g/nbUl4=", + "owner": "hyprwm", + "repo": "hyprgraphics", + "rev": "52202272d89da32a9f866c0d10305a5e3d954c50", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprgraphics", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "aquamarine": "aquamarine", + "hyprcursor": "hyprcursor", + "hyprgraphics": "hyprgraphics", + "hyprland-protocols": "hyprland-protocols", + "hyprland-qtutils": "hyprland-qtutils", + "hyprlang": "hyprlang", + "hyprutils": "hyprutils", + "hyprwayland-scanner": "hyprwayland-scanner", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks", + "systems": "systems_2", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1737038559, + "narHash": "sha256-irqN8zKwpQ0NFxEvV/wQRdopClwkyZXCQoF7mgX/Uss=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "0dc7367a7006cc3cc877d52bf34c4998144bff84", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-plugins": { + "inputs": { + "hyprland": [ + "hyprland" + ], + "nixpkgs": [ + "hyprland-plugins", + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland-plugins", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1736372092, + "narHash": "sha256-+uxeBRTrDZsH6HtVtlMuJLLPJw3usPpG2/pm/L30c3E=", + "owner": "hyprwm", + "repo": "hyprland-plugins", + "rev": "b4c0fa3ebc6ccd1589dcd17904652223088efede", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-plugins", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1735774328, + "narHash": "sha256-vIRwLS9w+N99EU1aJ+XNOU6mJTxrUBa31i1r82l0V7s=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "e3b6af97ddcfaafbda8e2828c719a5af84f662cb", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprland-qtutils": { + "inputs": { + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1736114838, + "narHash": "sha256-FxbuGQExtN37ToWYnGmO6weOYN6WPHN/RAqbr7gNPek=", + "owner": "hyprwm", + "repo": "hyprland-qtutils", + "rev": "6997fe382dcf396704227d2b98ffdd5066da6959", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-qtutils", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1735393019, + "narHash": "sha256-NPpqA8rtmDLsEmZOmz+qR67zsB6Y503Jnv+nSFLKJZ8=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "55608efdaa387af7bfdc0eddb404c409958efa43", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprutils": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1736164519, + "narHash": "sha256-1LimBKvDpBbeX+qW7T240WEyw+DBVpDotZB4JYm8Aps=", + "owner": "hyprwm", + "repo": "hyprutils", + "rev": "3c895da64b0eb19870142196fa48c07090b441c4", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprutils", + "type": "github" + } + }, + "hyprwayland-scanner": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1735493474, + "narHash": "sha256-fktzv4NaqKm94VAkAoVqO/nqQlw+X0/tJJNAeCSfzK4=", + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "rev": "de913476b59ee88685fdc018e77b8f6637a2ae0b", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "type": "github" + } + }, "nix-flatpak": { "locked": { "lastModified": 1711997201, @@ -39,16 +403,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1736549401, - "narHash": "sha256-ibkQrMHxF/7TqAYcQE+tOnIsSEzXmMegzyBWza6uHKM=", - "owner": "nixos", + "lastModified": 1736012469, + "narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "1dab772dd4a68a7bba5d9460685547ff8e17d899", + "rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-24.11", + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -69,13 +433,126 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1736549401, + "narHash": "sha256-ibkQrMHxF/7TqAYcQE+tOnIsSEzXmMegzyBWza6uHKM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "1dab772dd4a68a7bba5d9460685547ff8e17d899", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1735882644, + "narHash": "sha256-3FZAG+pGt3OElQjesCAWeMkQ7C/nB1oTHLRQ8ceP110=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "a5a961387e75ae44cc20f0a57ae463da5e959656", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { + "anyrun": "anyrun", "home-manager": "home-manager", + "hyprland": "hyprland", + "hyprland-plugins": "hyprland-plugins", "nix-flatpak": "nix-flatpak", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable" } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "hyprwayland-scanner": [ + "hyprland", + "hyprwayland-scanner" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1734907020, + "narHash": "sha256-p6HxwpRKVl1KIiY5xrJdjcEeK3pbmc///UOyV6QER+w=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "d7f18dda5e511749fa1511185db3536208fb1a63", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 86f9762..d41442c 100644 --- a/flake.nix +++ b/flake.nix @@ -9,13 +9,24 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; # Managing flatpak apps nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1"; - + # hyprland and plugins + hyprland.url = "github:hyprwm/Hyprland"; + hyprland-plugins = { + url = "github:hyprwm/hyprland-plugins"; + inputs.hyprland.follows = "hyprland"; + }; + anyrun = { + url = "github:anyrun-org/anyrun"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, nixpkgs, home-manager, + hyprland-plugins, + anyrun, ... } @ inputs: { @@ -26,10 +37,12 @@ specialArgs = { inherit inputs; }; modules = [ ./hosts/spectre-x360-2018 + # {environment.systemPackages = [ anyrun.packages.${system}.anyrun ];} home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit inputs; }; home-manager.users.remy.imports = [ ./users/remy.nix diff --git a/hosts/spectre-x360-2018/default.nix b/hosts/spectre-x360-2018/default.nix index 5a887b2..05cac3b 100644 --- a/hosts/spectre-x360-2018/default.nix +++ b/hosts/spectre-x360-2018/default.nix @@ -5,7 +5,7 @@ ./configuration.nix ./hardware-configuration.nix ../../modules/nixos/flatpak.nix - ../../modules/nixos/gdm.nix + ../../modules/nixos/hyprland.nix ../../modules/nixos/monitoring.nix ../../modules/nixos/nvidia.nix ../../modules/nixos/pipewire.nix diff --git a/modules/home-manager/backup.nix b/modules/home-manager/backup.nix index fb1d7ab..dfebe68 100644 --- a/modules/home-manager/backup.nix +++ b/modules/home-manager/backup.nix @@ -1,17 +1,25 @@ {pkgs, ...}: { - # Add a udev rule that launches a backup using restic when a specific USB device (the backup drive) is plugged in + # Add a udev rule that launches a backup using restic when a specific USB device (the backup drive) is plugged in - environment.systemPackages = with pkgs; [ - restic - ]; - services.udev.packages = [ - (pkgs.writeTextFile { - name = "bakc"; - text = '' - SUBSYSTEMS=="usb", ATTRS{idVendor}=="3297", ATTRS{idProduct}=="1969", MODE="0666", TAG+="uaccess", SYMLINK+="stm32_dfu", GROUP="plugdev" - ''; - destination = "/etc/udev/rules.d/50-zsa.rules"; - }) - ]; + environment.systemPackages = with pkgs; [ + restic + ]; + + # the udev rule: + services.udev.extraRules = '' + ACTION=="add", SUBSYSTEM=="block", ENV{ID_FS_LABEL}=="backup-restic", TAG+="systemd", ENV{SYSTEMD_WANTS}="backup-restic.service" + ''; + + # the systemd service: + systemd.services.backup-restic = { + description = "Backup using restic (triggered when USB drive is plugged in)"; + after = [ "local-fs.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + # TODO: adapt command + ExecStart = "${pkgs.restic}/bin/restic backup /home/username"; + }; + }; } \ No newline at end of file diff --git a/modules/home-manager/hyprland-customization.nix b/modules/home-manager/hyprland-customization.nix new file mode 100644 index 0000000..b0d1b1c --- /dev/null +++ b/modules/home-manager/hyprland-customization.nix @@ -0,0 +1,49 @@ +{inputs, pkgs, ...}: +{ + programs.kitty.enable = true; + wayland.windowManager.hyprland = { + enable = true; + settings = { + "$mod" = "SUPER"; + bind = + [ + "$mod, F, exec, firefox" + "$mod, return exec, anyrun" + "$mod_SHIFT, return, exec, kitty" + "$mod_SHIFT, q, kill" + "$mod, s, exec, code" + ]; + }; + + plugins = [ + inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.hyprbars + # inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.hyprmenu + # Touch gestures: https://github.com/horriblename/hyprgrass + # inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.hyprgrass + # Virtual desktops: https://github.com/levnikmyskin/hyprland-virtual-desktops + # inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.hyprland-virtual-desktops + ]; + }; + + # programs.anyrun = { + # enable = true; + # config = { + # x = { fraction = 0.5; }; + # y = { fraction = 0.3; }; + # width = { fraction = 0.3; }; + # hideIcons = false; + # ignoreExclusiveZones = false; + # layer = "overlay"; + # hidePluginInfo = false; + # closeOnClick = false; + # showResultsImmediately = false; + # maxEntries = null; + + # plugins = [ + # # An array of all the plugins you want, which either can be paths to the .so files, or their packages + # inputs.anyrun.packages.${pkgs.system}.applications + # inputs.anyrun.packages.${pkgs.system}.symbol + # ]; + # }; + # }; +} diff --git a/modules/nixos/hyprland.nix b/modules/nixos/hyprland.nix new file mode 100644 index 0000000..4e530fe --- /dev/null +++ b/modules/nixos/hyprland.nix @@ -0,0 +1,16 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + programs.uwsm.enable = true; + + programs.hyprland = { + enable = true; + xwayland.enable = false; + withUWSM = true; + }; + +} diff --git a/modules/nixos/nvidia.nix b/modules/nixos/nvidia.nix index e9b8a44..b0d0635 100644 --- a/modules/nixos/nvidia.nix +++ b/modules/nixos/nvidia.nix @@ -17,19 +17,18 @@ enable = true; }; hardware.nvidia = { - prime = { - nvidiaBusId = "PCI:1:0:0"; - intelBusId = "PCI:0:2:0"; - - }; + # prime = { + # nvidiaBusId = "PCI:1:0:0"; + # intelBusId = "PCI:0:2:0"; + # }; modesetting.enable = true; - powerManagement.enable = false; + powerManagement.enable = true; powerManagement.finegrained = false; open = false; nvidiaSettings = false; package = config.boot.kernelPackages.nvidiaPackages.mkDriver { - version = "565.77"; # latest + version = "565.77"; sha256_64bit = "sha256-CnqnQsRrzzTXZpgkAtF7PbH9s7wbiTRNcM0SPByzFHw="; sha256_aarch64 = "sha256-LSAYUnhfnK3rcuPe1dixOwAujSof19kNOfdRHE7bToE="; openSha256 = "sha256-Fxo0t61KQDs71YA8u7arY+503wkAc1foaa51vi2Pl5I="; @@ -37,7 +36,7 @@ persistencedSha256 = "sha256-wnDjC099D8d9NJSp9D0CbsL+vfHXyJFYYgU3CwcqKww="; }; }; - + # overwrite the blacklists set previously boot.extraModprobeConfig = ""; boot.blacklistedKernelModules = []; services.udev.extraRules = ""; diff --git a/users/remy.nix b/users/remy.nix index 6592b1b..0da3267 100644 --- a/users/remy.nix +++ b/users/remy.nix @@ -6,7 +6,8 @@ with lib.hm.gvariant; ../modules/home-manager/code.nix ../modules/home-manager/fish.nix ../modules/home-manager/flatpaks.nix - ../modules/home-manager/gnome-shell-customization.nix + ../modules/home-manager/hyprland-customization.nix + # ../modules/home-manager/gnome-shell-customization.nix ../modules/home-manager/keepassxc.nix ../modules/home-manager/obsidian.nix ../modules/home-manager/owncloud-client.nix @@ -32,28 +33,28 @@ with lib.hm.gvariant; }; - ## Gnome keyboard and mouse settings - dconf.settings = { - # set the keyboard layout to german - "org/gnome/desktop/input-sources" = { - current = mkUint32 0; - sources = [ (mkTuple [ "xkb" "de" ]) (mkTuple [ "xkb" "ch" ]) (mkTuple [ "xkb" "us" ]) ]; - xkb-options = [ "lv3:ralt_switch" ]; - }; + # ## Gnome keyboard and mouse settings + # dconf.settings = { + # # set the keyboard layout to german + # "org/gnome/desktop/input-sources" = { + # current = mkUint32 0; + # sources = [ (mkTuple [ "xkb" "de" ]) (mkTuple [ "xkb" "ch" ]) (mkTuple [ "xkb" "us" ]) ]; + # xkb-options = [ "lv3:ralt_switch" ]; + # }; - "org/gnome/desktop/peripherals/keyboard" = { - numlock-state = true; - }; + # "org/gnome/desktop/peripherals/keyboard" = { + # numlock-state = true; + # }; - "org/gnome/desktop/peripherals/mouse" = { - natural-scroll = false; - speed = 0.20851063829787231; - }; + # "org/gnome/desktop/peripherals/mouse" = { + # natural-scroll = false; + # speed = 0.20851063829787231; + # }; - "org/gnome/desktop/peripherals/touchpad" = { - tap-to-click = true; - two-finger-scrolling-enabled = true; - speed = 0.16872427983539096; - }; - }; + # "org/gnome/desktop/peripherals/touchpad" = { + # tap-to-click = true; + # two-finger-scrolling-enabled = true; + # speed = 0.16872427983539096; + # }; + # }; } diff --git a/utils/binary-cache.nix b/utils/binary-cache.nix index 9fc2778..0bc3480 100644 --- a/utils/binary-cache.nix +++ b/utils/binary-cache.nix @@ -17,6 +17,14 @@ # the default public key of cache.nixos.org, it's built-in, no need to add it here "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ]; + builders-use-substitutes = true; + extra-substituters = [ + "https://anyrun.cachix.org" + ]; + + extra-trusted-public-keys = [ + "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s=" + ]; }; }