simplify activation, reduce closure size of base

This commit is contained in:
Daniel Olsen 2022-06-03 12:22:24 +02:00
parent 5fa15dcdc3
commit bfddea286a
7 changed files with 54 additions and 38 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
result

View File

@ -32,14 +32,18 @@
hmChannel.lib.homeManagerConfiguration { hmChannel.lib.homeManagerConfiguration {
inherit configuration system username homeDirectory stateVersion extraSpecialArgs; inherit configuration system username homeDirectory stateVersion extraSpecialArgs;
}; };
mkHomes = machines: extraArgs: nixlib.genAttrs machines (machine: mkHome {inherit machine; } // extraArgs);
allMachines = [ "laptop" "desktop" "headless" "pvv-terminal" ];
in in
{ {
homeConfigurations = nixlib.genAttrs [ "laptop" ] (machine: mkHome { inherit machine; }) homeConfigurations = mkHomes [ "laptop" "headless" ] { }
// nixlib.genAttrs [ "desktop" ] (machine: mkHome { inherit machine; username = "dan"; }) // mkHomes [ "desktop" ] { username = "dan"; }
// nixlib.genAttrs [ "pvv-terminal" ] (machine: mkHome {inherit machine; username = "danio"; homeDirectory = "/home/pvv/d/danio";}); // mkHomes [ "pvv-terminal" ] { username = "danio"; homeDirectory = "/home/pvv/d/danio"; };
nixosModules = { nixosModules = {
home-manager = nixlib.genAttrs [ "laptop" "desktop" "pvv-terminal" ] (machine: import ./machines/${machine}.nix); home-manager = nixlib.genAttrs allMachines (machine: import ./machines/${machine}.nix);
}; };
overlays = [ overlays = [
@ -51,5 +55,12 @@
}) })
nur.overlay nur.overlay
]; ];
homeActivations = nixlib.genAttrs allMachines (machine: self.homeConfigurations.${machine}.activationPackage);
apps.x86_64-linux = nixlib.genAttrs allMachines (machine: {
type = "app";
program = "${self.homeActivations.${machine}}/activate";
});
}; };
} }

View File

@ -13,6 +13,7 @@
secondary-fs = "/mnt/henning"; secondary-fs = "/mnt/henning";
}; };
profiles.base.enable = true; profiles.base.enable = true;
profiles.base.plus = true;
profiles.xsession.enable = true; profiles.xsession.enable = true;
profiles.zsh.enable = true; profiles.zsh.enable = true;

18
machines/headless.nix Normal file
View File

@ -0,0 +1,18 @@
{ config, lib, pkgs, overlays, ... }:
{
nixpkgs.overlays = overlays;
imports = [ ../profiles ];
machine = {
name = "Headless";
eth = null;
wlan = null;
secondary-fs = null;
};
profiles.base.enable = true;
profiles.base.enable = false;
profiles.zsh.enable = true;
}

View File

@ -12,6 +12,7 @@
wlan = "wlp5s0"; wlan = "wlp5s0";
}; };
profiles.base.enable = true; profiles.base.enable = true;
profiles.base.plus = true;
profiles.gui.enable = true; profiles.gui.enable = true;
profiles.xsession.enable = true; profiles.xsession.enable = true;
profiles.zsh.enable = true; profiles.zsh.enable = true;

View File

@ -12,6 +12,7 @@
secondary-fs = null; secondary-fs = null;
}; };
profiles.base.enable = true; profiles.base.enable = true;
profiles.base.plus = false;
profiles.gui.enable = true; profiles.gui.enable = true;
profiles.non-nixos.enable = true; profiles.non-nixos.enable = true;
profiles.xsession.enable = true; profiles.xsession.enable = true;

View File

@ -19,15 +19,12 @@ in {
options.profiles.base = { options.profiles.base = {
enable = lib.mkEnableOption "The base profile, should be always enabled"; enable = lib.mkEnableOption "The base profile, should be always enabled";
plus = lib.mkEnableOption "Useful things you arguably don't NEED";
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
#libguestfs
#ansible
#nixops
nix-output-monitor nix-output-monitor
nix-top nix-top
nix-index nix-index
@ -55,24 +52,12 @@ in {
bat bat
exa exa
ripgrep ripgrep
] ++ lib.optionals cfg.plus [
mkvtoolnix
# unstable.youtubeDL
ffmpeg-full ffmpeg-full
] ++ lib.optionals config.profiles.gui.enable [ ] ++ lib.optionals config.profiles.gui.enable [
# virtmanager
# virt-viewer
thunderbird
mpv mpv
sxiv sxiv
mumble
#dan.rank_photos
dolphin plasma5Packages.dolphin-plugins dolphin plasma5Packages.dolphin-plugins
ffmpegthumbs ffmpegthumbs
plasma5Packages.kdegraphics-thumbnailers plasma5Packages.kdegraphics-thumbnailers
@ -82,21 +67,23 @@ in {
gnome3.gedit gnome3.gedit
vscodium vscodium
gimp
] ++ lib.optionals (config.profiles.gui.enable && cfg.plus) [
mumble
# texlive.combined.scheme-full # texlive.combined.scheme-full
# kile # kile
libreoffice libreoffice
thunderbird
gimp
# krita
# inkscape
# digikam
# godot
# blender
# audacity
# mixxx
# ardour
kdenlive kdenlive
frei0r frei0r
audacity
inkscape
blender
mkvtoolnix
] ++ lib.optionals (config.nixpkgs.config.allowUnfree && config.profiles.gui.enable) [ ] ++ lib.optionals (config.nixpkgs.config.allowUnfree && config.profiles.gui.enable) [
geogebra geogebra
]; ];
@ -127,7 +114,7 @@ in {
extensions = with pkgs.nur.repos.rycee.firefox-addons; [ bitwarden cookies-txt https-everywhere metamask no-pdf-download sponsorblock ublock-origin ]; extensions = with pkgs.nur.repos.rycee.firefox-addons; [ bitwarden cookies-txt https-everywhere metamask no-pdf-download sponsorblock ublock-origin ];
}; };
programs.obs-studio.enable = config.profiles.gui.enable; programs.obs-studio.enable = (config.profiles.gui.enable && cfg.plus);
programs.git = { programs.git = {
@ -150,6 +137,7 @@ in {
}; };
"desktop" = { "desktop" = {
hostname = "10.42.42.10"; hostname = "10.42.42.10";
proxyJump = "lilith";
user = "dan"; user = "dan";
}; };
"laptop" = { "laptop" = {
@ -173,11 +161,6 @@ in {
}; };
}; };
# services.kdeconnect = {
# enable = true;
# indicator = true;
# };
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = true;
defaultCacheTtl = 1800; defaultCacheTtl = 1800;