feat: home-manager?

This commit is contained in:
Kat Inskip 2024-07-13 17:47:03 -07:00
parent b4b8f5988f
commit 672ffc38cc
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
8 changed files with 74 additions and 44 deletions

View file

@ -6,6 +6,7 @@
}: }:
with lib; let with lib; let
pkgs = channels.nixpkgs; pkgs = channels.nixpkgs;
enabledNixosSystems = filterAttrs (_: system: system.config.ci.enable and system.config.type == "NixOS") channels.nixfiles.systems;
in { in {
imports = [ ./common.nix ]; imports = [ ./common.nix ];
config = { config = {
@ -32,7 +33,7 @@ in {
workflow_dispatch = {}; workflow_dispatch = {};
}; };
jobs = let jobs = let
genericNixosBuildJob = name: system: nameValuePair "${name}" { genericNixosBuildJob = name: system: nameValuePair "nixos-${name}" {
step.${name} = { step.${name} = {
name = "build system closure for ${name}"; name = "build system closure for ${name}";
order = 500; order = 500;
@ -45,16 +46,14 @@ in {
}; };
}; };
}; };
enabledNixosSystems = filterAttrs (_: system: system.config.ci.enable) channels.nixfiles.systems;
nixosBuildJobs = mapAttrs' genericNixosBuildJob enabledNixosSystems; nixosBuildJobs = mapAttrs' genericNixosBuildJob enabledNixosSystems;
in nixosBuildJobs; in nixosBuildJobs;
}; };
jobs = let jobs = let
genericNixosBuildJob = name: system: nameValuePair "${name}" ({ ... }: { genericNixosBuildJob = name: system: nameValuePair "nixos-${name}" ({ ... }: {
imports = [ ./packages.nix ]; imports = [ ./packages.nix ];
}); });
enabledNixosSystems = filterAttrs (_: system: system.config.ci.enable) channels.nixfiles.systems;
nixosBuildJobs = mapAttrs' genericNixosBuildJob enabledNixosSystems; nixosBuildJobs = mapAttrs' genericNixosBuildJob enabledNixosSystems;
in nixosBuildJobs; in nixosBuildJobs;

54
flake.lock generated
View file

@ -1,7 +1,9 @@
{ {
"nodes": { "nodes": {
"arcexprs": { "arcexprs": {
"flake": false, "inputs": {
"nixpkgs": "nixpkgs"
},
"locked": { "locked": {
"lastModified": 1720471472, "lastModified": 1720471472,
"narHash": "sha256-2mq+DpPirJ+0M6fxQYTaXiI7Z+CdKSXjTxoy93stX1g=", "narHash": "sha256-2mq+DpPirJ+0M6fxQYTaXiI7Z+CdKSXjTxoy93stX1g=",
@ -370,11 +372,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1720880492, "lastModified": 1720896272,
"narHash": "sha256-mzkonDtAmLxtvqd8p6ooR0NOFUcisM7l/j3uf/eZ8zU=", "narHash": "sha256-8ZiWP+XbyrJ6MOQL0XHiz4OKJNBLnV9avwTesbwMbdc=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "Hyprland", "repo": "Hyprland",
"rev": "45c48984236d7a682a1941b147f8ae489ac9a1e6", "rev": "bc6b0880dda2607a80f000c134f573c970452a0f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -724,18 +726,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1720542800, "lastModified": 1683185507,
"narHash": "sha256-ZgnNHuKV6h2+fQ5LuqnUaqZey1Lqqt5dTUAiAnqH0QQ=", "narHash": "sha256-Wcj09pigMFgj+0borXeoJvVMwH2Rc4gkSq4BwNq3k7s=",
"owner": "nixos", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "feb2849fdeb70028c70d73b848214b00d324a497", "rev": "63464b8c2837ec56e1d610f5bd2a9b8e1f532c07",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "id": "nixpkgs",
"ref": "nixos-unstable", "type": "indirect"
"repo": "nixpkgs",
"type": "github"
} }
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
@ -754,13 +754,29 @@
"type": "github" "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": { "nur": {
"locked": { "locked": {
"lastModified": 1720891420, "lastModified": 1720908054,
"narHash": "sha256-NGqWtKIVF6zSDaYS6YepdLIQ4LLhBMPit5UsX7X5B5M=", "narHash": "sha256-nRmtu5zaYvzvonEZaQlORbIoZvctVy3P3YraH/ChzG0=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "ecde873d238284ccb47675c15436b55f6d6ec285", "rev": "fc076c6c1c848d6f950303f937b26d202b23d4b0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -779,11 +795,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1720863765, "lastModified": 1720896694,
"narHash": "sha256-Q+LSZm9w1htVrRDY1d+0T8rBdifA/6JnAWuBMneGCCE=", "narHash": "sha256-lKInIpVIrI4YOTwbaN6wwQ+EvhL/iVqKhpxcTj4kBhE=",
"owner": "pjones", "owner": "pjones",
"repo": "plasma-manager", "repo": "plasma-manager",
"rev": "40fa15eceeda6f3fb539367ccee462fa06a4d760", "rev": "809d86d6a8a48b6d71b6ece05eeb5e55f554b396",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -862,7 +878,7 @@
"minecraft": "minecraft", "minecraft": "minecraft",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs_2",
"nur": "nur", "nur": "nur",
"plasma-manager": "plasma-manager", "plasma-manager": "plasma-manager",
"pypi-deps-db": "pypi-deps-db", "pypi-deps-db": "pypi-deps-db",

View file

@ -189,7 +189,6 @@
# a bunch of modules (also arcnmx is good) # a bunch of modules (also arcnmx is good)
arcexprs = { arcexprs = {
url = "github:arcnmx/nixexprs/master"; url = "github:arcnmx/nixexprs/master";
flake = false;
}; };
base16 = { base16 = {
url = "github:arcnmx/base16.nix/flake"; url = "github:arcnmx/base16.nix/flake";

7
home/user/home.nix Normal file
View file

@ -0,0 +1,7 @@
_: {
home = {
homeDirectory = "/home/kat";
stateVersion = "22.11";
username = "kat";
};
}

View file

@ -8,9 +8,9 @@
inputs, inputs,
... ...
}: let }: let
inherit (lib.modules) mkIf mkOptionDefault; inherit (lib.modules) mkIf mkOptionDefault mkMerge;
inherit (lib.trivial) mapNullable; inherit (lib.trivial) mapNullable;
inherit (std) string; inherit (std) string set;
in { in {
options = let options = let
inherit (lib.types) str listOf attrs unspecified enum; inherit (lib.types) str listOf attrs unspecified enum;
@ -78,15 +78,19 @@ in {
home = "home"; home = "home";
} }
.${string.toLower config.type}; .${string.toLower config.type};
modules = with tree; mkIf (config.folder != "linux") [ modules = mkMerge [
(mkIf (config.folder != "linux") [
# per-OS modules # per-OS modules
modules.${config.folder} tree.modules.${config.folder}
# per-OS user definition
tree.home.user.${config.folder}
])
(mkIf (config.folder != "linux" && config.folder != "home") [
# per-OS configuration # per-OS configuration
tree.${config.folder}.common tree.${config.folder}.common
# per-OS user definition
home.user.${config.folder}
# true base module # true base module
common tree.common
])
]; ];
builder = builder =
{ {
@ -114,7 +118,12 @@ in {
]; ];
specialArgs = {prev = nixos;}; 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; darwin = inputs.darwin.lib.darwinSystem;
macos = inputs.darwin.lib.darwinSystem; macos = inputs.darwin.lib.darwinSystem;
} }
@ -128,6 +137,11 @@ in {
specialArgs = { specialArgs = {
inherit name inputs std tree; inherit name inputs std tree;
systemType = config.folder; systemType = config.folder;
nur = import inputs.nur {
pkgs = pkgs.${config.system};
nurpkgs = pkgs.${config.system};
};
machine = name;
system = config; system = config;
}; };
}; };

View file

@ -3,10 +3,8 @@
tree, tree,
... ...
}: }:
map (path: import "${path}/overlay.nix") [ [
inputs.arcexprs (final: prev: inputs.arcexprs.overlays.default final prev)
]
++ [
inputs.darwin.overlays.default inputs.darwin.overlays.default
inputs.deploy-rs.overlay inputs.deploy-rs.overlay
#inputs.hypridle.overlays.default #inputs.hypridle.overlays.default

View file

@ -13,6 +13,7 @@
tree.modules.system tree.modules.system
]; ];
specialArgs = { specialArgs = {
machine = name;
inherit name inputs std tree pkgs; inherit name inputs std tree pkgs;
}; };
}) })

View file

@ -10,16 +10,12 @@ _: let
imports = imports =
with tree.home.profiles; [ with tree.home.profiles; [
common common
];
home-manager.users.kat = {
imports = with tree.home.profiles; [
devops devops
graphical graphical
neovim neovim
shell shell
]; ];
}; };
};
in { in {
arch = "x86_64"; arch = "x86_64";
type = "Home"; type = "Home";