mirror of
https://github.com/srid/nixos-config.git
synced 2026-05-11 00:55:58 +08:00
Add flake app to update primary inputs
This commit is contained in:
parent
884d21954d
commit
253ebc7254
1 changed files with 24 additions and 13 deletions
37
lib.nix
37
lib.nix
|
|
@ -56,10 +56,8 @@
|
|||
};
|
||||
|
||||
perSystem = { system, pkgs, lib, ... }: {
|
||||
# A rough app for activating the system locally.
|
||||
#
|
||||
# TODO: Replace with deploy-rs or (new) nixinate
|
||||
apps.activate =
|
||||
# TODO: replace these with mission-control
|
||||
apps =
|
||||
let
|
||||
# Create a flake app that wraps the given bash CLI.
|
||||
bashCmdApp = name: cmd: {
|
||||
|
|
@ -74,14 +72,27 @@
|
|||
}) + "/bin/${name}";
|
||||
};
|
||||
in
|
||||
if system == "aarch64-darwin" then
|
||||
bashCmdApp "darwin" ''
|
||||
${self.darwinConfigurations.default.system}/sw/bin/darwin-rebuild \
|
||||
switch --flake ${self}#default
|
||||
''
|
||||
else
|
||||
bashCmdApp "linux" ''
|
||||
${lib.getExe pkgs.nixos-rebuild} --use-remote-sudo switch -j auto
|
||||
'';
|
||||
{
|
||||
# A rough app for activating the system locally.
|
||||
#
|
||||
# TODO: Replace with deploy-rs or (new) nixinate
|
||||
activate =
|
||||
if system == "aarch64-darwin" then
|
||||
bashCmdApp "darwin" ''
|
||||
${self.darwinConfigurations.default.system}/sw/bin/darwin-rebuild \
|
||||
switch --flake ${self}#default
|
||||
''
|
||||
else
|
||||
bashCmdApp "linux" ''
|
||||
${lib.getExe pkgs.nixos-rebuild} --use-remote-sudo switch -j auto
|
||||
'';
|
||||
|
||||
update-primary =
|
||||
let inputs = [ "nixpkgs" "home-manager" "darwin" ];
|
||||
in bashCmdApp "update-primary" ''
|
||||
nix flake lock ${lib.foldl' (acc: x: acc + " --update-input " + x) "" inputs}
|
||||
'';
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue