refactor: nix-system commands

nixos
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;
let
nom-system = pkgs.writeShellApplication {
nom-system = pkgs.writeFishApplication {
name = "nom-system";
runtimeInputs = with pkgs; [ nix-output-monitor ];
text = ''
nom build --no-link "/home/moritz/.dotfiles#nixosConfigurations.$(hostname).config.system.build.toplevel"
text = /* fish */ ''
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 {
name = "f";
@ -57,8 +63,6 @@ in
mv = "mv -i";
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";
latexwatch = ''find -type f -name "*.tex" | entr -c latexmk -pdf -silent'';
@ -105,6 +109,8 @@ in
bottom
# nix
(nom-system-command "nixos-boot" "sudo nixos-rebuild boot --flake ~/.dotfiles")
(nom-system-command "nixos-switch" "sudo nixos-rebuild switch --flake ~/.dotfiles")
comma
nix-index
nixpkgs-fmt