From 006814d6c1c0bbcbb5c26362338ef67256190089 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 15 May 2024 20:44:17 +0100 Subject: [PATCH] added just commands, updated flake --- flake.lock | 7 +++---- flake.nix | 2 +- home/users/admin/default.nix | 1 - home/users/sam/default.nix | 4 ---- hosts/common/core/default.nix | 6 ++++++ hosts/common/users/admin/default.nix | 4 ---- hosts/common/users/sam/default.nix | 3 --- justfile | 31 ++++++++++++++++++++++++++++ 8 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 justfile diff --git a/flake.lock b/flake.lock index 94b96f6..8f9536a 100644 --- a/flake.lock +++ b/flake.lock @@ -27,16 +27,15 @@ ] }, "locked": { - "lastModified": 1715381426, - "narHash": "sha256-wPuqrAQGdv3ISs74nJfGb+Yprm23U/rFpcHFFNWgM94=", + "lastModified": 1715486357, + "narHash": "sha256-4pRuzsHZOW5W4CsXI9uhKtiJeQSUoe1d2M9mWU98HC4=", "owner": "nix-community", "repo": "home-manager", - "rev": "ab5542e9dbd13d0100f8baae2bc2d68af901f4b4", + "rev": "44677a1c96810a8e8c4ffaeaad10c842402647c1", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.11", "repo": "home-manager", "type": "github" } diff --git a/flake.nix b/flake.nix index a735418..bcbbb33 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ # Home manager home-manager = { - url = "github:nix-community/home-manager/release-23.11"; + url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; diff --git a/home/users/admin/default.nix b/home/users/admin/default.nix index f2107a5..f03360f 100644 --- a/home/users/admin/default.nix +++ b/home/users/admin/default.nix @@ -19,7 +19,6 @@ shellAliases = { ll = "ls -l"; - update = "sudo nixos-rebuild switch --flake $(readlink -f /etc/nixos)#fileserver"; }; history.size = 10000; history.path = "${config.xdg.dataHome}/zsh/history"; diff --git a/home/users/sam/default.nix b/home/users/sam/default.nix index 62dc430..e71d4cf 100644 --- a/home/users/sam/default.nix +++ b/home/users/sam/default.nix @@ -25,10 +25,6 @@ shellAliases = { ll = "ls -l"; - update = "sudo nixos-rebuild switch --flake $(readlink -f /etc/nixos)#nixdev"; - update-home = "home-manager switch --flake $(readlink -f /etc/nixos)#sam@nixdev"; - nix-home = "nvim $HOME/nixos/hosts/workmachine/home.nix"; - nix-conf = "nvim $HOME/nixos/hosts/workmachine/configuration.nix"; }; history.size = 10000; history.path = "${config.xdg.dataHome}/zsh/history"; diff --git a/hosts/common/core/default.nix b/hosts/common/core/default.nix index 21b0bdb..07ddcf7 100644 --- a/hosts/common/core/default.nix +++ b/hosts/common/core/default.nix @@ -3,4 +3,10 @@ ./sops.nix ]; + environment.systemPackages = [ + pkgs.rsync + pkgs.curl + pkgs.just + ]; + } diff --git a/hosts/common/users/admin/default.nix b/hosts/common/users/admin/default.nix index b629ce7..adedd87 100644 --- a/hosts/common/users/admin/default.nix +++ b/hosts/common/users/admin/default.nix @@ -20,9 +20,5 @@ in programs.zsh.enable = true; environment.systemPackages = [ - pkgs.rsync - pkgs.curl - pkgs.tmux - pkgs.neovim ]; } diff --git a/hosts/common/users/sam/default.nix b/hosts/common/users/sam/default.nix index 28b3835..6b0436c 100644 --- a/hosts/common/users/sam/default.nix +++ b/hosts/common/users/sam/default.nix @@ -31,8 +31,5 @@ in }; environment.systemPackages = [ - pkgs.rsync - pkgs.curl - pkgs.just ]; } diff --git a/justfile b/justfile new file mode 100644 index 0000000..cd22b3d --- /dev/null +++ b/justfile @@ -0,0 +1,31 @@ +SOPS_FILE := "../nix-secrets/secrets.yaml" + +# default recipe to display help information +default: + @just --list + +# ensure the latest revisions of nix-secrets are used next time a rebuild occurs +update-nix-secrets: + (cd ../nix-secrets && git fetch && git rebase) || true + nix flake lock --update-input nix-secrets + +# full system rebuild from flake (stages changes and automatically detects host) +rebuild-system: + git add *.nix + sudo nixos-rebuild switch --flake $(readlink -f /etc/nixos)#$(hostname) + +# updates all flake inputs for system +update-flake: + nix flake update + +# edit sops file +edit-sops: + echo "Editing {{SOPS_FILE}}" + nix-shell -p sops --run "SOPS_AGE_KEY_FILE=~/.config/sops/age/keys.txt sops {{SOPS_FILE}}" + +# update +update-secrets: + cd $HOME/nix-secrets && (\ + nix-shell -p sops --run "sops updatekeys -y secrets.yaml" && \ + git add -u && (git commit -m "updated secrets" || true) && git push \ + )