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, ... }:
|
||||
let
|
||||
cfg = config.sconfig.flakes;
|
||||
upgradeArg = if cfg.rebuildPath == "/etc/nixos" then "--recreate-lock-file" else "--refresh";
|
||||
in
|
||||
{
|
||||
options.sconfig.flakes = {
|
||||
|
@ -20,7 +21,7 @@ in
|
|||
'';
|
||||
|
||||
system.autoUpgrade.flake = cfg.rebuildPath;
|
||||
system.autoUpgrade.flags = [ (lib.optionalString (cfg.rebuildPath == "/etc/nixos") "--recreate-lock-file") ];
|
||||
system.autoUpgrade.flags = [ upgradeArg ];
|
||||
|
||||
environment.systemPackages = map
|
||||
(x: (pkgs.writeShellScriptBin
|
||||
|
@ -31,9 +32,9 @@ in
|
|||
[ "switch" "switch" ]
|
||||
[ "build" "build" ]
|
||||
[ "boot" "boot" ]
|
||||
[ "switch-upgrade" "switch" (if cfg.rebuildPath == "/etc/nixos" then "--recreate-lock-file" else "--refresh") ]
|
||||
[ "build-upgrade" "build" (if cfg.rebuildPath == "/etc/nixos" then "--recreate-lock-file" else "--refresh") ]
|
||||
[ "boot-upgrade" "boot" (if cfg.rebuildPath == "/etc/nixos" then "--recreate-lock-file" else "--refresh") ]
|
||||
[ "switch-upgrade" "switch" upgradeArg ]
|
||||
[ "build-upgrade" "build" upgradeArg ]
|
||||
[ "boot-upgrade" "boot" upgradeArg ]
|
||||
];
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue