nixos: move nh to workstation

This commit is contained in:
ooks-io 2024-10-27 23:17:11 +11:00
parent 27a9e04281
commit 018e2e7bad
2 changed files with 22 additions and 8 deletions

View file

@ -1,4 +1,5 @@
{ {
inputs',
inputs, inputs,
pkgs, pkgs,
lib, lib,
@ -7,7 +8,7 @@
}: let }: let
inherit (builtins) attrValues; inherit (builtins) attrValues;
inherit (lib) mkIf mapAttrsToList; inherit (lib) mkIf mapAttrsToList;
inherit (config.ooknet.host) admin; inherit (config.ooknet.host) role admin;
in { in {
environment = { environment = {
# disable default nix packages # disable default nix packages
@ -15,11 +16,21 @@ in {
defaultPackages = []; defaultPackages = [];
systemPackages = attrValues { systemPackages = attrValues {
inherit (pkgs) git deadnix statix; inherit (pkgs) git deadnix statix;
inherit (inputs.agenix.packages.${pkgs.system}) default; inherit (inputs'.agenix.packages) default;
}; };
# location of the configuration flake
variables.FLAKE = "/home/${admin.name}/.config/ooknet";
}; };
nix = { nix = {
# package = pkgs.lix; # package = pkgs.lix;
# collect garbage
gc = {
automatic = true;
dates = "Sun *-*-* 14:00";
options = "--delete-older-than 14d";
};
registry = { registry = {
nixpkgs.flake = inputs.nixpkgs; nixpkgs.flake = inputs.nixpkgs;
default.flake = inputs.nixpkgs; default.flake = inputs.nixpkgs;
@ -56,14 +67,9 @@ in {
}; };
# nix rebuild utililty # nix rebuild utililty
programs.nh = { programs.nh = mkIf (role == "workstation") {
enable = true; enable = true;
# sets an environment variable FLAKE that nh will refer to by default # sets an environment variable FLAKE that nh will refer to by default
flake = mkIf admin.homeManager "/home/${admin.name}/.config/ooknet"; flake = mkIf admin.homeManager "/home/${admin.name}/.config/ooknet";
# garbage collect
clean = {
enable = true;
extraArgs = "--keep 5 --keep-since 14d";
};
}; };
} }

View file

@ -0,0 +1,8 @@
{config, ...}: let
inherit (config.ooknet.host) admin;
in {
programs.nh = {
enable = true;
flake = "/home/${admin.name}/.config/ooknet";
};
}