From 672ffc38cc2b5daaec149e32a318c9c402ceb7e7 Mon Sep 17 00:00:00 2001 From: Kat Inskip Date: Sat, 13 Jul 2024 17:47:03 -0700 Subject: [PATCH] feat: home-manager? --- ci/nodes.nix | 7 +++--- flake.lock | 54 ++++++++++++++++++++++++++--------------- flake.nix | 1 - home/user/home.nix | 7 ++++++ modules/system/host.nix | 38 ++++++++++++++++++++--------- overlays.nix | 6 ++--- systems/default.nix | 1 + systems/fullhome.nix | 4 --- 8 files changed, 74 insertions(+), 44 deletions(-) create mode 100644 home/user/home.nix diff --git a/ci/nodes.nix b/ci/nodes.nix index 35e82b82..7e8cd5e9 100644 --- a/ci/nodes.nix +++ b/ci/nodes.nix @@ -6,6 +6,7 @@ }: with lib; let pkgs = channels.nixpkgs; + enabledNixosSystems = filterAttrs (_: system: system.config.ci.enable and system.config.type == "NixOS") channels.nixfiles.systems; in { imports = [ ./common.nix ]; config = { @@ -32,7 +33,7 @@ in { workflow_dispatch = {}; }; jobs = let - genericNixosBuildJob = name: system: nameValuePair "${name}" { + genericNixosBuildJob = name: system: nameValuePair "nixos-${name}" { step.${name} = { name = "build system closure for ${name}"; order = 500; @@ -45,16 +46,14 @@ in { }; }; }; - enabledNixosSystems = filterAttrs (_: system: system.config.ci.enable) channels.nixfiles.systems; nixosBuildJobs = mapAttrs' genericNixosBuildJob enabledNixosSystems; in nixosBuildJobs; }; jobs = let - genericNixosBuildJob = name: system: nameValuePair "${name}" ({ ... }: { + genericNixosBuildJob = name: system: nameValuePair "nixos-${name}" ({ ... }: { imports = [ ./packages.nix ]; }); - enabledNixosSystems = filterAttrs (_: system: system.config.ci.enable) channels.nixfiles.systems; nixosBuildJobs = mapAttrs' genericNixosBuildJob enabledNixosSystems; in nixosBuildJobs; diff --git a/flake.lock b/flake.lock index 2350c59a..1b856445 100644 --- a/flake.lock +++ b/flake.lock @@ -1,7 +1,9 @@ { "nodes": { "arcexprs": { - "flake": false, + "inputs": { + "nixpkgs": "nixpkgs" + }, "locked": { "lastModified": 1720471472, "narHash": "sha256-2mq+DpPirJ+0M6fxQYTaXiI7Z+CdKSXjTxoy93stX1g=", @@ -370,11 +372,11 @@ ] }, "locked": { - "lastModified": 1720880492, - "narHash": "sha256-mzkonDtAmLxtvqd8p6ooR0NOFUcisM7l/j3uf/eZ8zU=", + "lastModified": 1720896272, + "narHash": "sha256-8ZiWP+XbyrJ6MOQL0XHiz4OKJNBLnV9avwTesbwMbdc=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "45c48984236d7a682a1941b147f8ae489ac9a1e6", + "rev": "bc6b0880dda2607a80f000c134f573c970452a0f", "type": "github" }, "original": { @@ -724,18 +726,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1720542800, - "narHash": "sha256-ZgnNHuKV6h2+fQ5LuqnUaqZey1Lqqt5dTUAiAnqH0QQ=", - "owner": "nixos", + "lastModified": 1683185507, + "narHash": "sha256-Wcj09pigMFgj+0borXeoJvVMwH2Rc4gkSq4BwNq3k7s=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "feb2849fdeb70028c70d73b848214b00d324a497", + "rev": "63464b8c2837ec56e1d610f5bd2a9b8e1f532c07", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "id": "nixpkgs", + "type": "indirect" } }, "nixpkgs-stable": { @@ -754,13 +754,29 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1720768451, + "narHash": "sha256-EYekUHJE2gxeo2pM/zM9Wlqw1Uw2XTJXOSAO79ksc4Y=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7e7c39ea35c5cdd002cd4588b03a3fb9ece6fad9", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nur": { "locked": { - "lastModified": 1720891420, - "narHash": "sha256-NGqWtKIVF6zSDaYS6YepdLIQ4LLhBMPit5UsX7X5B5M=", + "lastModified": 1720908054, + "narHash": "sha256-nRmtu5zaYvzvonEZaQlORbIoZvctVy3P3YraH/ChzG0=", "owner": "nix-community", "repo": "NUR", - "rev": "ecde873d238284ccb47675c15436b55f6d6ec285", + "rev": "fc076c6c1c848d6f950303f937b26d202b23d4b0", "type": "github" }, "original": { @@ -779,11 +795,11 @@ ] }, "locked": { - "lastModified": 1720863765, - "narHash": "sha256-Q+LSZm9w1htVrRDY1d+0T8rBdifA/6JnAWuBMneGCCE=", + "lastModified": 1720896694, + "narHash": "sha256-lKInIpVIrI4YOTwbaN6wwQ+EvhL/iVqKhpxcTj4kBhE=", "owner": "pjones", "repo": "plasma-manager", - "rev": "40fa15eceeda6f3fb539367ccee462fa06a4d760", + "rev": "809d86d6a8a48b6d71b6ece05eeb5e55f554b396", "type": "github" }, "original": { @@ -862,7 +878,7 @@ "minecraft": "minecraft", "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nur": "nur", "plasma-manager": "plasma-manager", "pypi-deps-db": "pypi-deps-db", diff --git a/flake.nix b/flake.nix index d7a4d5ec..a30569c3 100644 --- a/flake.nix +++ b/flake.nix @@ -189,7 +189,6 @@ # a bunch of modules (also arcnmx is good) arcexprs = { url = "github:arcnmx/nixexprs/master"; - flake = false; }; base16 = { url = "github:arcnmx/base16.nix/flake"; diff --git a/home/user/home.nix b/home/user/home.nix new file mode 100644 index 00000000..2f66429b --- /dev/null +++ b/home/user/home.nix @@ -0,0 +1,7 @@ +_: { + home = { + homeDirectory = "/home/kat"; + stateVersion = "22.11"; + username = "kat"; + }; +} \ No newline at end of file diff --git a/modules/system/host.nix b/modules/system/host.nix index 7cc073d7..610e1de9 100644 --- a/modules/system/host.nix +++ b/modules/system/host.nix @@ -8,9 +8,9 @@ inputs, ... }: let - inherit (lib.modules) mkIf mkOptionDefault; + inherit (lib.modules) mkIf mkOptionDefault mkMerge; inherit (lib.trivial) mapNullable; - inherit (std) string; + inherit (std) string set; in { options = let inherit (lib.types) str listOf attrs unspecified enum; @@ -78,15 +78,19 @@ in { home = "home"; } .${string.toLower config.type}; - modules = with tree; mkIf (config.folder != "linux") [ - # per-OS modules - modules.${config.folder} - # per-OS configuration - tree.${config.folder}.common - # per-OS user definition - home.user.${config.folder} - # true base module - common + modules = mkMerge [ + (mkIf (config.folder != "linux") [ + # per-OS modules + tree.modules.${config.folder} + # per-OS user definition + tree.home.user.${config.folder} + ]) + (mkIf (config.folder != "linux" && config.folder != "home") [ + # per-OS configuration + tree.${config.folder}.common + # true base module + tree.common + ]) ]; builder = { @@ -114,7 +118,12 @@ in { ]; specialArgs = {prev = nixos;}; }; - home = args: inputs.home-manager.lib.homeManagerConfiguration (args // { inherit pkgs; }); + home = args: let + renamedArgs = set.rename "specialArgs" "extraSpecialArgs" args; + renamedArgsWithPkgs = renamedArgs // { inherit lib; pkgs = pkgs.${args.system}; }; + attrsToRemove = [ "configuration" "username" "homeDirectory" "stateVersion" "extraModules" "system" ]; + safeArgs = removeAttrs renamedArgsWithPkgs attrsToRemove; + in inputs.home-manager.lib.homeManagerConfiguration safeArgs; darwin = inputs.darwin.lib.darwinSystem; macos = inputs.darwin.lib.darwinSystem; } @@ -128,6 +137,11 @@ in { specialArgs = { inherit name inputs std tree; systemType = config.folder; + nur = import inputs.nur { + pkgs = pkgs.${config.system}; + nurpkgs = pkgs.${config.system}; + }; + machine = name; system = config; }; }; diff --git a/overlays.nix b/overlays.nix index 6417eece..4109c77f 100644 --- a/overlays.nix +++ b/overlays.nix @@ -3,10 +3,8 @@ tree, ... }: -map (path: import "${path}/overlay.nix") [ - inputs.arcexprs -] -++ [ +[ + (final: prev: inputs.arcexprs.overlays.default final prev) inputs.darwin.overlays.default inputs.deploy-rs.overlay #inputs.hypridle.overlays.default diff --git a/systems/default.nix b/systems/default.nix index be0cf9e3..f61aad9e 100644 --- a/systems/default.nix +++ b/systems/default.nix @@ -13,6 +13,7 @@ tree.modules.system ]; specialArgs = { + machine = name; inherit name inputs std tree pkgs; }; }) diff --git a/systems/fullhome.nix b/systems/fullhome.nix index 1b9ddd5b..48591bc3 100644 --- a/systems/fullhome.nix +++ b/systems/fullhome.nix @@ -10,15 +10,11 @@ _: let imports = with tree.home.profiles; [ common - ]; - home-manager.users.kat = { - imports = with tree.home.profiles; [ devops graphical neovim shell ]; - }; }; in { arch = "x86_64";