Restructure flake.nix for a simpler config for building different images off the same NixOS config.

This commit is contained in:
Tom Alexander
2025-10-11 00:08:02 -04:00
parent 69b5cf9217
commit 3bf84445a3
121 changed files with 2937 additions and 3074 deletions

View File

@@ -21,6 +21,13 @@ in
imports = [ ];
options.me = {
git.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install git.";
};
git.config = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
@@ -29,51 +36,53 @@ in
};
};
config = lib.mkMerge [
{
environment.systemPackages = with pkgs; [
my_git
];
}
(lib.mkIf (config.me.git.config != null) {
me.install.user.talexander.file = {
".gitconfig" = {
source = config.me.git.config;
config = lib.mkIf config.me.git.enable (
lib.mkMerge [
{
environment.systemPackages = with pkgs; [
my_git
];
}
(lib.mkIf (config.me.git.config != null) {
me.install.user.talexander.file = {
".gitconfig" = {
source = config.me.git.config;
};
};
};
})
(lib.mkIf (config.me.graphical) {
nixpkgs.overlays = [
(final: prev: {
my_git = (
pkgs.buildEnv {
name = prev.git.name;
version = prev.git.version;
paths =
(builtins.map (git_wrapped prev.git) [
"git"
])
++ [
prev.git
})
(lib.mkIf (config.me.graphical) {
nixpkgs.overlays = [
(final: prev: {
my_git = (
pkgs.buildEnv {
name = prev.git.name;
version = prev.git.version;
paths =
(builtins.map (git_wrapped prev.git) [
"git"
])
++ [
prev.git
];
extraOutputsToInstall = [
"man"
"doc"
"info"
];
extraOutputsToInstall = [
"man"
"doc"
"info"
];
nativeBuildInputs = [ final.makeWrapper ];
ignoreCollisions = true;
}
);
})
];
})
(lib.mkIf (!config.me.graphical) {
nixpkgs.overlays = [
(final: prev: {
my_git = prev.git;
})
];
})
];
nativeBuildInputs = [ final.makeWrapper ];
ignoreCollisions = true;
}
);
})
];
})
(lib.mkIf (!config.me.graphical) {
nixpkgs.overlays = [
(final: prev: {
my_git = prev.git;
})
];
})
]
);
}