mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-11-09 18:47:02 +00:00
add flake path option to rebuild scripts
This commit is contained in:
parent
2b82727230
commit
4356f1d2fb
3 changed files with 30 additions and 16 deletions
|
@ -1,5 +1,8 @@
|
|||
{
|
||||
outputs = { self, nixpkgs }: {
|
||||
nixosModule = import ./.;
|
||||
nixosModule = { ... }: {
|
||||
imports = [ ./. ];
|
||||
config = { sconfig.flakes.enable = true; };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,18 +8,6 @@ let
|
|||
"-git-assume-unchanged-size 0"
|
||||
];
|
||||
|
||||
rebuild-scripts = (map
|
||||
(x: (pkgs.writeShellScriptBin "sc-${builtins.head x}" "nixos-rebuild ${lib.concatStringsSep " " (builtins.tail x)}"))
|
||||
[
|
||||
[ "switch" "switch" ]
|
||||
[ "build" "build" ]
|
||||
[ "boot" "boot" ]
|
||||
[ "switch-upgrade" "switch" "--recreate-lock-file" "--refresh" ]
|
||||
[ "build-upgrade" "build" "--recreate-lock-file" "--refresh" ]
|
||||
[ "boot-upgrade" "boot" "--recreate-lock-file" "--refresh" ]
|
||||
]
|
||||
);
|
||||
|
||||
in
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
@ -78,7 +66,7 @@ in
|
|||
echo "$(git ls-remote https://github.com/NixOS/nixpkgs.git "$branch" | cut -f1) latest available"
|
||||
echo
|
||||
'')
|
||||
] ++ rebuild-scripts;
|
||||
];
|
||||
|
||||
environment.variables.EDITOR = "vim";
|
||||
|
||||
|
|
|
@ -3,12 +3,35 @@ let
|
|||
cfg = config.sconfig.flakes;
|
||||
in
|
||||
{
|
||||
options.sconfig.flakes = lib.mkEnableOption "Enable Flakes";
|
||||
options.sconfig.flakes = {
|
||||
enable = lib.mkEnableOption "Enable Flakes";
|
||||
rebuildPath = lib.mkOption {
|
||||
default = "/etc/nixos";
|
||||
type = lib.types.str;
|
||||
description = "Flake to use when running nixos-rebuild helper scripts";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
config = lib.mkIf cfg {
|
||||
nix.package = pkgs.nixFlakes;
|
||||
nix.extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
|
||||
environment.systemPackages = map
|
||||
(x: (pkgs.writeShellScriptBin
|
||||
"sc-${builtins.head x}"
|
||||
"nixos-rebuild ${lib.concatStringsSep " " (builtins.tail x)} --flake ${cfg.rebuildPath}"
|
||||
))
|
||||
[
|
||||
[ "switch" "switch" ]
|
||||
[ "build" "build" ]
|
||||
[ "boot" "boot" ]
|
||||
[ "switch-upgrade" "switch" "--recreate-lock-file" "--refresh" ]
|
||||
[ "build-upgrade" "build" "--recreate-lock-file" "--refresh" ]
|
||||
[ "boot-upgrade" "boot" "--recreate-lock-file" "--refresh" ]
|
||||
];
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue