2021-01-17 22:08:34 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.sconfig.flakes;
|
|
|
|
in
|
|
|
|
{
|
2021-04-05 21:56:06 +00:00
|
|
|
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 {
|
2021-01-17 22:08:34 +00:00
|
|
|
|
2021-04-01 03:43:23 +00:00
|
|
|
nix.package = pkgs.nixFlakes;
|
|
|
|
nix.extraOptions = ''
|
|
|
|
experimental-features = nix-command flakes
|
|
|
|
'';
|
2021-04-05 21:56:06 +00:00
|
|
|
|
|
|
|
environment.systemPackages = map
|
2021-04-16 16:54:31 +00:00
|
|
|
(x: (pkgs.writeShellScriptBin "sc-${x}" "nixos-rebuild ${x} --refresh --flake ${cfg.rebuildPath}"))
|
|
|
|
[ "switch" "build" "boot" ];
|
2021-04-05 21:56:06 +00:00
|
|
|
|
2021-01-17 22:08:34 +00:00
|
|
|
};
|
|
|
|
}
|