From 181f1b27133a3416464e966481b5ebc3481ea0b3 Mon Sep 17 00:00:00 2001 From: mehbark Date: Tue, 15 Aug 2023 09:38:01 -0400 Subject: [PATCH] add build.conf.nix and stuff --- build.conf.nix | 3 +++ configuration.nix | 3 +-- flake.nix | 11 ++++++++++- home.nix | 27 +++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 build.conf.nix diff --git a/build.conf.nix b/build.conf.nix new file mode 100644 index 0000000..755c4fa --- /dev/null +++ b/build.conf.nix @@ -0,0 +1,3 @@ +{ + use-x11 = false; +} diff --git a/configuration.nix b/configuration.nix index 6ff5a1a..2340c82 100644 --- a/configuration.nix +++ b/configuration.nix @@ -4,7 +4,7 @@ { config, pkgs, ... }: let - use-x11 = false; + use-x11 = (import ./build.conf.nix).use-x11; in { nix = { @@ -70,7 +70,6 @@ in }; programs.hyprland.enable = !use-x11; - programs.sway.enable = !use-x11; # Enable CUPS to print documents. services.printing.enable = true; diff --git a/flake.nix b/flake.nix index 77d74d4..501c68e 100644 --- a/flake.nix +++ b/flake.nix @@ -4,8 +4,9 @@ inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; inputs.home-manager.url = "github:nix-community/home-manager"; inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs"; + inputs.hyprland.url = "github:hyprwm/Hyprland"; - outputs = inputs@{ self, nixpkgs, home-manager }: { + outputs = inputs@{ self, nixpkgs, home-manager, hyprland, ... }: { nixosConfigurations = { nix = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -20,5 +21,13 @@ ]; }; }; + homeConfigurations."mbk@nix" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + + modules = [ + hyprland.homeManagerModules.default + {wayland.windowManager.hyprland.enable = true;} + ]; + }; }; } diff --git a/home.nix b/home.nix index 29cf531..b2192e5 100644 --- a/home.nix +++ b/home.nix @@ -1,4 +1,7 @@ { config, pkgs, ... }: +let + use-x11 = (import ./build.conf.nix).use-x11; +in { /* The home.stateVersion option does not have a default and must be set */ home.stateVersion = "22.05"; @@ -104,4 +107,28 @@ enable = true; extraConfig = import ./kitty.conf.nix; }; + + wayland.windowManager.hyprland.extraConfig = '' + $mod = SUPER + + bind = $mod, F, exec, firefox + bind = , Print, exec, grimblast copy area + + # workspaces + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} + ${builtins.concatStringsSep "\n" (builtins.genList ( + x: let + ws = let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in '' + bind = $mod, ${ws}, workspace, ${toString (x + 1)} + bind = $mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)} + '' + ) + 10)} + + # ... + ''; }