From 1e8a45546a958596f946e73086f22bc6d20f6c58 Mon Sep 17 00:00:00 2001 From: mehbark Date: Tue, 15 Aug 2023 18:19:41 -0400 Subject: [PATCH] working towards selectable wm --- build.conf.nix | 13 +++++++++---- configuration.nix | 3 ++- flake.lock | 40 +++++++++++++++++++++++++++++++++++++--- flake.nix | 20 +++++++++++++++----- home.nix | 9 ++++----- 5 files changed, 67 insertions(+), 18 deletions(-) diff --git a/build.conf.nix b/build.conf.nix index 442c650..2f85c27 100644 --- a/build.conf.nix +++ b/build.conf.nix @@ -1,8 +1,13 @@ +{ wm ? null, ...}: with builtins; -{ - wm = "plasma"; +rec { + wm = wm; + + 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 ["plasma" "xmonad" "i3"]; - is-wayland = wm: elem wm ["hyprland" "sway"]; + is-x11 = wm: elem wm x11-wms; + is-wayland = wm: elem wm wayland-wms; } diff --git a/configuration.nix b/configuration.nix index 4d0dde4..e3a86d7 100644 --- a/configuration.nix +++ b/configuration.nix @@ -2,9 +2,10 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). +build-conf: { config, pkgs, ... }: let - conf = import ./build.conf.nix; + conf = build-conf; x11 = conf.is-x11 conf.wm; in { diff --git a/flake.lock b/flake.lock index 5a2809b..8f5d713 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -7,11 +25,11 @@ ] }, "locked": { - "lastModified": 1692081771, - "narHash": "sha256-LWhyDz3gi1RzTcW6e6iwfs4VuDWFajOexBKygNIqvQM=", + "lastModified": 1692131549, + "narHash": "sha256-MFjI8NL63/6HjMZpvJgnB/Pgg2dht22t45jOYtipZig=", "owner": "nix-community", "repo": "home-manager", - "rev": "18791781ea86cbec6bce8bcb847444b9c73b8b3b", + "rev": "75cfe974e2ca05a61b66768674032b4c079e55d4", "type": "github" }, "original": { @@ -38,9 +56,25 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "home-manager": "home-manager", "nixpkgs": "nixpkgs" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 0fd337b..431b5c5 100644 --- a/flake.nix +++ b/flake.nix @@ -4,21 +4,31 @@ 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"; - outputs = inputs@{ self, nixpkgs, home-manager, ... }: { - nixosConfigurations = { + outputs = inputs@{ self, nixpkgs, home-manager, flake-utils, ... }: + let + conf = (import ./build.conf.nix) {}; + in + { + nixosConfigurations = + flake-utils.lib.eachSystem conf.wms (wm: + let + conf = import (./build.conf.nix) { wm = wm; }; + in + { nix = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ - ./configuration.nix + (./configuration.nix conf) home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.mbk = import ./home.nix; + home-manager.users.mbk = (import ./home.nix) conf; } ]; }; - }; + }); }; } diff --git a/home.nix b/home.nix index 4fa578b..a0e533c 100644 --- a/home.nix +++ b/home.nix @@ -1,6 +1,7 @@ +build-conf: { config, pkgs, ... }: let - conf = import ./build.conf.nix; + conf = build-conf; wm = conf.wm; in { @@ -131,10 +132,8 @@ in programs.git = { enable = true; - extraConfig = { - userName = "mehbark"; - userEmail = "terezi@pyrope.net"; - }; + userName = "mehbark"; + userEmail = "terezi@pyrope.net"; }; programs.git.difftastic = {