improve build.conf.nix, work towards hyprland again

This commit is contained in:
mehbark 2023-08-15 22:11:37 -04:00
parent a8da028c92
commit f93369194f
5 changed files with 182 additions and 13 deletions

View file

@ -3,11 +3,12 @@ with builtins;
input // input //
rec { rec {
# should probably split plasma into plasma-x11 and plasma-wayland at some point # 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"]; x11-wms = ["plasma" "xmonad" "i3"];
wayland-wms = ["hyprland" "sway"]; wayland-wms = ["hyprland" "sway"];
wms = x11-wms ++ wayland-wms; wms = x11-wms ++ wayland-wms;
# very, very non-exhaustive of course # very, very non-exhaustive of course
is-x11 = wm: elem wm x11-wms; is-x11 = elem wm x11-wms;
is-wayland = wm: elem wm wayland-wms; is-wayland = elem wm wayland-wms;
} }

View file

@ -6,7 +6,6 @@ build-conf:
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
conf = build-conf; conf = build-conf;
x11 = conf.is-x11 conf.wm;
in in
{ {
nix = { nix = {
@ -60,7 +59,7 @@ in
# x11 stuff # x11 stuff
services.xserver = { services.xserver = {
enable = x11; enable = conf.is-x11;
layout = "us"; layout = "us";
xkbVariant = ""; xkbVariant = "";

View file

@ -38,6 +38,53 @@
"type": "github" "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": { "nixlib": {
"locked": { "locked": {
"lastModified": 1689469483, "lastModified": 1689469483,
@ -75,6 +122,22 @@
} }
}, },
"nixpkgs": { "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": { "locked": {
"lastModified": 1692067901, "lastModified": 1692067901,
"narHash": "sha256-kq8Pf/nmlXECDWMkQSRGQkjWsA6G0pjzZkfUEaTmXJE=", "narHash": "sha256-kq8Pf/nmlXECDWMkQSRGQkjWsA6G0pjzZkfUEaTmXJE=",
@ -94,8 +157,9 @@
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"home-manager": "home-manager", "home-manager": "home-manager",
"hyprland": "hyprland",
"nixos-generators": "nixos-generators", "nixos-generators": "nixos-generators",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs_2"
} }
}, },
"systems": { "systems": {
@ -112,6 +176,69 @@
"repo": "default", "repo": "default",
"type": "github" "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", "root": "root",

View file

@ -1,17 +1,25 @@
{ {
description = "mehbark's NixOS configuration"; description = "mehbark's NixOS configuration";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; inputs = {
inputs.home-manager.url = "github:nix-community/home-manager"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
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";
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 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 = [ modules = [
((import ./configuration.nix) conf) ((import ./configuration.nix) conf)
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
@ -28,9 +36,20 @@
nix = nixpkgs.lib.nixosSystem { nix = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = modules; 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 = { packages.x86_64-linux = {
iso = nixos-generators.nixosGenerate { iso = nixos-generators.nixosGenerate {
system = "x86_64-linux"; system = "x86_64-linux";

View file

@ -158,6 +158,29 @@ in
then { then {
enable = true; enable = true;
enableNvidiaPatches = 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 {}; } else {};
# xsession.windowManager.i3 = if wm == "i3" # xsession.windowManager.i3 = if wm == "i3"