Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable nix tooling #930

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 39 additions & 26 deletions modules/common/development/nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ let
mkEnableOption
mkOption
mkIf
mkMerge
types
;
in
Expand All @@ -18,37 +19,49 @@ in
default = null;
description = "Path to the nixpkgs repository";
};
automatic-gc = {
enable = mkEnableOption "Enable automatic garbage collection";
};
};

config = mkIf cfg.enable {
nix = {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
keep-outputs = true;
keep-derivations = true;
};
config = mkMerge [
(mkIf cfg.enable {
nix = {
settings = {
experimental-features = [
"nix-command"
"flakes"
];
keep-outputs = true;
keep-derivations = true;
};

# avoid scenario where the host rootfs gets filled
# with nixos-rebuild ... switch generated excess
# generations and becomes unbootable
gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 3d";
};
# avoid scenario where the host rootfs gets filled
# with nixos-rebuild ... switch generated excess
# generations and becomes unbootable
gc = mkIf cfg.automatic-gc.enable {
automatic = true;
dates = "daily";
options = "--delete-older-than 3d";
};

# Set the path and registry so that e.g. nix-shell and repl work
nixPath = lib.mkIf (cfg.nixpkgs != null) [ "nixpkgs=${cfg.nixpkgs}" ];
# Set the path and registry so that e.g. nix-shell and repl work
nixPath = mkIf (cfg.nixpkgs != null) [ "nixpkgs=${cfg.nixpkgs}" ];

registry = lib.mkIf (cfg.nixpkgs != null) {
nixpkgs.to = {
type = "path";
path = cfg.nixpkgs;
registry = mkIf (cfg.nixpkgs != null) {
nixpkgs.to = {
type = "path";
path = cfg.nixpkgs;
};
};
};
};
};
})

(mkIf (!cfg.enable) {
nix = {
enable = lib.mkForce false;
gc.automatic = lib.mkForce false;
};
})
];
}
1 change: 1 addition & 0 deletions modules/microvm/virtualization/microvm/microvm-host.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ in
withHardenedConfigs = true;
};
ghaf.givc.host.enable = true;
ghaf.development.nix-setup.automatic-gc.enable = config.ghaf.development.nix-setup.enable;
services.logind.lidSwitch = "ignore";

# TODO: remove hardcoded paths
Expand Down
Loading