nixos: Include mutable flake in every system
This commit is contained in:
		| @@ -35,7 +35,7 @@ let | |||||||
|       system = null; |       system = null; | ||||||
|  |  | ||||||
|       # Put the inputs in specialArgs to avoid infinite recursion when modules try to do imports |       # Put the inputs in specialArgs to avoid infinite recursion when modules try to do imports | ||||||
|       specialArgs = { inherit inputs pkgsFlakes pkgsFlake allAssignments; inherit (cfg) systems; }; |       specialArgs = { inherit self inputs pkgsFlakes pkgsFlake allAssignments; inherit (cfg) systems; }; | ||||||
|  |  | ||||||
|       # `baseModules` informs the manual which modules to document |       # `baseModules` informs the manual which modules to document | ||||||
|       baseModules = |       baseModules = | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| { lib, pkgsFlake, pkgs, pkgs', inputs, config, ... }: | { lib, pkgsFlake, pkgs, pkgs', self, inputs, config, ... }: | ||||||
| let | let | ||||||
|   inherit (lib) mkIf mkDefault mkMerge; |   inherit (lib) mkIf mkDefault mkMerge; | ||||||
|   inherit (lib.my) mkDefault'; |   inherit (lib.my) mkDefault'; | ||||||
| @@ -127,6 +127,9 @@ in | |||||||
|         }; |         }; | ||||||
|       }; |       }; | ||||||
|  |  | ||||||
|  |       environment.etc = { | ||||||
|  |         "nixos/flake.nix".source = "/run/nixfiles/flake.nix"; | ||||||
|  |       }; | ||||||
|       environment.systemPackages = with pkgs; mkMerge [ |       environment.systemPackages = with pkgs; mkMerge [ | ||||||
|         [ |         [ | ||||||
|           bash-completion |           bash-completion | ||||||
| @@ -209,6 +212,29 @@ in | |||||||
|             # python.d plugin script does #!/usr/bin/env bash |             # python.d plugin script does #!/usr/bin/env bash | ||||||
|             path = with pkgs; [ bash ]; |             path = with pkgs; [ bash ]; | ||||||
|           }; |           }; | ||||||
|  |  | ||||||
|  |           nixfiles-mutable = { | ||||||
|  |             description = "Mutable nixfiles"; | ||||||
|  |             serviceConfig = { | ||||||
|  |               Type = "oneshot"; | ||||||
|  |               RemainAfterExit = true; | ||||||
|  |             }; | ||||||
|  |  | ||||||
|  |             path = with pkgs; [ util-linux ]; | ||||||
|  |             script = '' | ||||||
|  |               nixfilesDir="${self}" | ||||||
|  |  | ||||||
|  |               mkdir -p /run/nixfiles{,/.rw,/.work} | ||||||
|  |               mount -t overlay overlay -o lowerdir="$nixfilesDir",upperdir=/run/nixfiles/.rw,workdir=/run/nixfiles/.work /run/nixfiles | ||||||
|  |               chmod -R u+w /run/nixfiles | ||||||
|  |             ''; | ||||||
|  |             preStop = '' | ||||||
|  |               umount /run/nixfiles | ||||||
|  |               rm -rf /run/nixfiles | ||||||
|  |             ''; | ||||||
|  |  | ||||||
|  |             wantedBy = [ "multi-user.target" ]; | ||||||
|  |           }; | ||||||
|         }; |         }; | ||||||
|       }; |       }; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -82,6 +82,10 @@ in | |||||||
|       # NOTE: As the "outermost" module is still being evaluated in NixOS land, special params (e.g. pkgs) won't be |       # NOTE: As the "outermost" module is still being evaluated in NixOS land, special params (e.g. pkgs) won't be | ||||||
|       # passed to it |       # passed to it | ||||||
|       home-manager.users.${user'.name} = mkAliasDefinitions options.my.user.homeConfig; |       home-manager.users.${user'.name} = mkAliasDefinitions options.my.user.homeConfig; | ||||||
|  |  | ||||||
|  |       systemd.services.nixfiles-mutable.script = '' | ||||||
|  |         chown -R ${user'.name} /run/nixfiles | ||||||
|  |       ''; | ||||||
|     } |     } | ||||||
|     (mkIf (cfg.passwordSecret != null) { |     (mkIf (cfg.passwordSecret != null) { | ||||||
|       my = { |       my = { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user