mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-11-09 18:47:02 +00:00
refactor nixos rebuild arguments
This commit is contained in:
parent
704e9b53f1
commit
49d9ebb5e3
1 changed files with 5 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.sconfig.flakes;
|
cfg = config.sconfig.flakes;
|
||||||
|
upgradeArg = if cfg.rebuildPath == "/etc/nixos" then "--recreate-lock-file" else "--refresh";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.sconfig.flakes = {
|
options.sconfig.flakes = {
|
||||||
|
@ -20,7 +21,7 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
system.autoUpgrade.flake = cfg.rebuildPath;
|
system.autoUpgrade.flake = cfg.rebuildPath;
|
||||||
system.autoUpgrade.flags = [ (lib.optionalString (cfg.rebuildPath == "/etc/nixos") "--recreate-lock-file") ];
|
system.autoUpgrade.flags = [ upgradeArg ];
|
||||||
|
|
||||||
environment.systemPackages = map
|
environment.systemPackages = map
|
||||||
(x: (pkgs.writeShellScriptBin
|
(x: (pkgs.writeShellScriptBin
|
||||||
|
@ -31,9 +32,9 @@ in
|
||||||
[ "switch" "switch" ]
|
[ "switch" "switch" ]
|
||||||
[ "build" "build" ]
|
[ "build" "build" ]
|
||||||
[ "boot" "boot" ]
|
[ "boot" "boot" ]
|
||||||
[ "switch-upgrade" "switch" (if cfg.rebuildPath == "/etc/nixos" then "--recreate-lock-file" else "--refresh") ]
|
[ "switch-upgrade" "switch" upgradeArg ]
|
||||||
[ "build-upgrade" "build" (if cfg.rebuildPath == "/etc/nixos" then "--recreate-lock-file" else "--refresh") ]
|
[ "build-upgrade" "build" upgradeArg ]
|
||||||
[ "boot-upgrade" "boot" (if cfg.rebuildPath == "/etc/nixos" then "--recreate-lock-file" else "--refresh") ]
|
[ "boot-upgrade" "boot" upgradeArg ]
|
||||||
];
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue