From f93369194f9935223cee1f2dfae524e2a0ed97b2 Mon Sep 17 00:00:00 2001 From: mehbark Date: Tue, 15 Aug 2023 22:11:37 -0400 Subject: [PATCH] improve build.conf.nix, work towards hyprland again --- build.conf.nix | 5 +- configuration.nix | 3 +- flake.lock | 129 +++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 35 ++++++++++--- home.nix | 23 +++++++++ 5 files changed, 182 insertions(+), 13 deletions(-) diff --git a/build.conf.nix b/build.conf.nix index f32bcb1..4b2cf12 100644 --- a/build.conf.nix +++ b/build.conf.nix @@ -3,11 +3,12 @@ with builtins; input // rec { # should probably split plasma into plasma-x11 and plasma-wayland at some point + # not all of these actually work btw x11-wms = ["plasma" "xmonad" "i3"]; wayland-wms = ["hyprland" "sway"]; wms = x11-wms ++ wayland-wms; # very, very non-exhaustive of course - is-x11 = wm: elem wm x11-wms; - is-wayland = wm: elem wm wayland-wms; + is-x11 = elem wm x11-wms; + is-wayland = elem wm wayland-wms; } diff --git a/configuration.nix b/configuration.nix index e3a86d7..0eb62a8 100644 --- a/configuration.nix +++ b/configuration.nix @@ -6,7 +6,6 @@ build-conf: { config, pkgs, ... }: let conf = build-conf; - x11 = conf.is-x11 conf.wm; in { nix = { @@ -60,7 +59,7 @@ in # x11 stuff services.xserver = { - enable = x11; + enable = conf.is-x11; layout = "us"; xkbVariant = ""; diff --git a/flake.lock b/flake.lock index 32c8b41..2d32011 100644 --- a/flake.lock +++ b/flake.lock @@ -38,6 +38,53 @@ "type": "github" } }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": "nixpkgs", + "systems": "systems_2", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1692123043, + "narHash": "sha256-6YoTjAZgtJb9OzKrZxtLxjfYiGWSqMmh1Wyh9dvwXn8=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "4986d74ef201171a930c312a8e3b72a22d9b84ee", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, "nixlib": { "locked": { "lastModified": 1689469483, @@ -75,6 +122,22 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1691654369, + "narHash": "sha256-gSILTEx1jRaJjwZxRlnu3ZwMn1FVNk80qlwiCX8kmpo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ce5e4a6ef2e59d89a971bc434ca8ca222b9c7f5e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1692067901, "narHash": "sha256-kq8Pf/nmlXECDWMkQSRGQkjWsA6G0pjzZkfUEaTmXJE=", @@ -94,8 +157,9 @@ "inputs": { "flake-utils": "flake-utils", "home-manager": "home-manager", + "hyprland": "hyprland", "nixos-generators": "nixos-generators", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" } }, "systems": { @@ -112,6 +176,69 @@ "repo": "default", "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" + } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1691073628, + "narHash": "sha256-LlxE3o3UzRY7APYVLGNKM30DBMcDifCRIQiMVSbYLIc=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "c74f89d4f84bfed0284d3908aee5d207698c70c5", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "c74f89d4f84bfed0284d3908aee5d207698c70c5", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1691841170, + "narHash": "sha256-RCTm1/MVWYPnReMgyp7tr2ogGYo/pvw38jZaFwemgPU=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "57a3a41ba6b358109e4fc25c6a4706b5f7d93c6b", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 81068e8..6269af5 100644 --- a/flake.nix +++ b/flake.nix @@ -1,17 +1,25 @@ { description = "mehbark's NixOS configuration"; - 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.flake-utils.url = "github:numtide/flake-utils"; - inputs.nixos-generators.url = "github:nix-community/nixos-generators"; - inputs.nixos-generators.inputs.nixpkgs.follows = "nixpkgs"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - outputs = inputs@{ self, nixpkgs, home-manager, flake-utils, nixos-generators, ... }: + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + + flake-utils.url = "github:numtide/flake-utils"; + + nixos-generators.url = "github:nix-community/nixos-generators"; + nixos-generators.inputs.nixpkgs.follows = "nixpkgs"; + + hyprland.url = "github:hyprwm/Hyprland"; + }; + + outputs = inputs@{ self, nixpkgs, home-manager, flake-utils, nixos-generators, hyprland, ... }: let # :( - conf = (import ./build.conf.nix) { wm = "plasma"; }; + # could do like nix-i3, nix-hyprland but that would be LAME + conf = (import ./build.conf.nix) { wm = "hyprland"; }; modules = [ ((import ./configuration.nix) conf) home-manager.nixosModules.home-manager @@ -28,9 +36,20 @@ nix = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = modules; + specialArgs = { inherit inputs; }; }; }; + homeConfigurations."mbk@nix" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + + modules = if conf.wm == "hyprland" then modules ++ [ + hyprland.homeManagerModules.default + {wayland.windowManager.hyprland.enable = true;} + ] else modules; + }; + + # meh, doesn't rly work packages.x86_64-linux = { iso = nixos-generators.nixosGenerate { system = "x86_64-linux"; diff --git a/home.nix b/home.nix index a0e533c..3789428 100644 --- a/home.nix +++ b/home.nix @@ -158,6 +158,29 @@ in then { enable = true; enableNvidiaPatches = true; + 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)} + + # ... + ''; } else {}; # xsession.windowManager.i3 = if wm == "i3"