simplify activation, reduce closure size of base

This commit is contained in:
Daniel Lovbrotte 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 {
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
{
homeConfigurations = nixlib.genAttrs [ "laptop" ] (machine: mkHome { inherit machine; })
// nixlib.genAttrs [ "desktop" ] (machine: mkHome { inherit machine; username = "dan"; })
// nixlib.genAttrs [ "pvv-terminal" ] (machine: mkHome {inherit machine; username = "danio"; homeDirectory = "/home/pvv/d/danio";});
homeConfigurations = mkHomes [ "laptop" "headless" ] { }
// mkHomes [ "desktop" ] { username = "dan"; }
// mkHomes [ "pvv-terminal" ] { username = "danio"; homeDirectory = "/home/pvv/d/danio"; };
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 = [
@ -51,5 +55,12 @@
})
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";
};
profiles.base.enable = true;
profiles.base.plus = true;
profiles.xsession.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";
};
profiles.base.enable = true;
profiles.base.plus = true;
profiles.gui.enable = true;
profiles.xsession.enable = true;
profiles.zsh.enable = true;

View File

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

View File

@ -19,15 +19,12 @@ in {
options.profiles.base = {
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 {
home.packages = with pkgs; [
#libguestfs
#ansible
#nixops
nix-output-monitor
nix-top
nix-index
@ -55,24 +52,12 @@ in {
bat
exa
ripgrep
mkvtoolnix
# unstable.youtubeDL
] ++ lib.optionals cfg.plus [
ffmpeg-full
] ++ lib.optionals config.profiles.gui.enable [
# virtmanager
# virt-viewer
thunderbird
mpv
sxiv
mumble
#dan.rank_photos
dolphin plasma5Packages.dolphin-plugins
ffmpegthumbs
plasma5Packages.kdegraphics-thumbnailers
@ -82,22 +67,24 @@ in {
gnome3.gedit
vscodium
gimp
] ++ lib.optionals (config.profiles.gui.enable && cfg.plus) [
mumble
# texlive.combined.scheme-full
# kile
libreoffice
thunderbird
gimp
# krita
# inkscape
# digikam
# godot
# blender
# audacity
# mixxx
# ardour
kdenlive
frei0r
] ++ lib.optionals (config.nixpkgs.config.allowUnfree && config.profiles.gui.enable) [
audacity
inkscape
blender
mkvtoolnix
] ++ lib.optionals (config.nixpkgs.config.allowUnfree && config.profiles.gui.enable) [
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 ];
};
programs.obs-studio.enable = config.profiles.gui.enable;
programs.obs-studio.enable = (config.profiles.gui.enable && cfg.plus);
programs.git = {
@ -150,6 +137,7 @@ in {
};
"desktop" = {
hostname = "10.42.42.10";
proxyJump = "lilith";
user = "dan";
};
"laptop" = {
@ -173,11 +161,6 @@ in {
};
};
# services.kdeconnect = {
# enable = true;
# indicator = true;
# };
services.gpg-agent = {
enable = true;
defaultCacheTtl = 1800;