refactor: nix-system commands

dev-docs
Moritz Böhme 2023-08-26 11:35:11 +02:00
parent ee0568559a
commit ec1a6acebc
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
1 changed files with 12 additions and 6 deletions

View File

@ -6,14 +6,20 @@
with lib; with lib;
let let
nom-system = pkgs.writeShellApplication { nom-system = pkgs.writeFishApplication {
name = "nom-system"; name = "nom-system";
runtimeInputs = with pkgs; [ nix-output-monitor ]; runtimeInputs = with pkgs; [ nix-output-monitor ];
text = '' text = /* fish */ ''
nom build --no-link "/home/moritz/.dotfiles#nixosConfigurations.$(hostname).config.system.build.toplevel" nom build --no-link "/home/moritz/.dotfiles#nixosConfigurations.$(hostname).config.system.build.toplevel" $argv
'';
};
nom-system-command = name: command: pkgs.writeFishApplication {
inherit name;
runtimeInputs = with pkgs; [ nom-system nix ];
text = /* fish */ ''
nom-system $argv && ${command}
''; '';
}; };
nom-system-command = command: "${nom-system}/bin/nom-system && ${command}";
f = pkgs.writeFishApplication { f = pkgs.writeFishApplication {
name = "f"; name = "f";
@ -57,8 +63,6 @@ in
mv = "mv -i"; mv = "mv -i";
cd = "__zoxide_z"; cd = "__zoxide_z";
nixos-switch = nom-system-command "sudo nixos-rebuild switch --flake ~/.dotfiles";
nixos-boot = nom-system-command "sudo nixos-rebuild boot --flake ~/.dotfiles";
nixos-update = "pushd ~/.dotfiles && nix flake update && popd"; nixos-update = "pushd ~/.dotfiles && nix flake update && popd";
latexwatch = ''find -type f -name "*.tex" | entr -c latexmk -pdf -silent''; latexwatch = ''find -type f -name "*.tex" | entr -c latexmk -pdf -silent'';
@ -105,6 +109,8 @@ in
bottom bottom
# nix # nix
(nom-system-command "nixos-boot" "sudo nixos-rebuild boot --flake ~/.dotfiles")
(nom-system-command "nixos-switch" "sudo nixos-rebuild switch --flake ~/.dotfiles")
comma comma
nix-index nix-index
nixpkgs-fmt nixpkgs-fmt