all: lix, deploy-rs and just
This commit is contained in:
parent
c32de5aa8c
commit
a62e395a20
6 changed files with 82 additions and 17 deletions
|
@ -109,8 +109,8 @@
|
|||
};
|
||||
|
||||
argon = import ./system/flakes/argon.nix {
|
||||
inherit (inputs) nixpkgs nixos-hardware home-manager agenix;
|
||||
inherit inputs;
|
||||
inherit (inputs) nixpkgs nixos-hardware home-manager agenix neovim-nightly-overlay nifoc-overlay;
|
||||
inherit lix-module;
|
||||
};
|
||||
|
||||
neon = import ./system/flakes/neon.nix {
|
||||
|
@ -201,6 +201,7 @@
|
|||
packages = [
|
||||
inputs'.agenix.packages.agenix
|
||||
inputs'.deploy-rs.packages.default
|
||||
pkgs.just
|
||||
pkgs.nix-output-monitor
|
||||
];
|
||||
|
||||
|
|
|
@ -62,7 +62,6 @@ in
|
|||
];
|
||||
|
||||
shellAliases = {
|
||||
nrsw = "nixpkgs-switch";
|
||||
upa = "nix flake update ~/.config/nixpkgs -v && upn";
|
||||
ngc = "nix-collect-garbage -d && sudo nix-collect-garbage -d";
|
||||
nsr = "sudo nix-store --verify --check-contents --repair";
|
||||
|
@ -79,6 +78,37 @@ in
|
|||
echo "$argv" | base64 --decode
|
||||
'';
|
||||
|
||||
nrsw = /* fish */ ''
|
||||
set -f os (uname)
|
||||
set -f other_hostname $argv[1]
|
||||
|
||||
switch $os
|
||||
case Darwin
|
||||
set -f config_dir "$HOME/.config/nixpkgs"
|
||||
case Linux
|
||||
set -f config_dir /etc/nixos
|
||||
case '*'
|
||||
echo "Unsupported OS"
|
||||
exit 1
|
||||
end
|
||||
|
||||
pushd "$config_dir"
|
||||
rm -rf result
|
||||
|
||||
if test -z "$DIRENV_DIR"
|
||||
eval (direnv export fish 2>/dev/null)
|
||||
end
|
||||
|
||||
if test "$other_hostname" = ""
|
||||
just deploy-local-machine (hostname -s)
|
||||
else
|
||||
just deploy-remote-machine "$other_hostname"
|
||||
end
|
||||
|
||||
rm -f result
|
||||
popd
|
||||
'';
|
||||
|
||||
upn = /* fish */ ''
|
||||
set -f os (uname)
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ if test "$other_hostname" = ""
|
|||
end
|
||||
else
|
||||
git pull
|
||||
nom build --eval-store auto --store "ssh-ng://$other_hostname.ts.kempkens.network" ".#nixosConfigurations.$other_hostname.config.system.build.toplevel"
|
||||
nom build --eval-store auto --store "ssh-ng://root@$other_hostname.ts.kempkens.network" ".#nixosConfigurations.$other_hostname.config.system.build.toplevel"
|
||||
if test $status -eq 0
|
||||
deploy --skip-checks ".#$other_hostname"
|
||||
end
|
||||
|
|
29
justfile
Normal file
29
justfile
Normal file
|
@ -0,0 +1,29 @@
|
|||
default:
|
||||
@just --list
|
||||
|
||||
# Format the entire source tree
|
||||
fmt:
|
||||
treefmt
|
||||
|
||||
# Build a local machine
|
||||
build-local-machine target type='darwin':
|
||||
nom build ".#{{type}}Configurations.{{target}}.config.system.build.toplevel"
|
||||
|
||||
# Build a remote machine
|
||||
build-remote-machine target type='nixos':
|
||||
nom build --eval-store auto \
|
||||
--store 'ssh-ng://root@{{target}}.ts.kempkens.network' \
|
||||
'.#{{type}}Configurations.{{target}}.config.system.build.toplevel'
|
||||
|
||||
# Deploy to a local machine
|
||||
deploy-local-machine target type='darwin': _git-pull (build-local-machine target type)
|
||||
env TERM=xterm-256color {{type}}-rebuild switch --flake ".#{{target}}"
|
||||
attic push nifoc-systems /run/current-system
|
||||
|
||||
# Deploy to a remote machine
|
||||
deploy-remote-machine target type='nixos': _git-pull (build-remote-machine target type)
|
||||
deploy --skip-checks '.#{{target}}'
|
||||
ssh -t '{{target}}' attic push nifoc-systems /run/current-system
|
||||
|
||||
_git-pull:
|
||||
-git pull
|
|
@ -1,12 +1,12 @@
|
|||
{ nixpkgs, nixos-hardware, home-manager, agenix, inputs, ... }:
|
||||
{ nixpkgs, lix-module, nixos-hardware, home-manager, agenix, neovim-nightly-overlay, nifoc-overlay }:
|
||||
|
||||
let
|
||||
default-system = "aarch64-linux";
|
||||
|
||||
nixpkgsConfig = {
|
||||
overlays = [
|
||||
inputs.neovim-nightly-overlay.overlays.default
|
||||
inputs.nifoc-overlay.overlay
|
||||
neovim-nightly-overlay.overlays.default
|
||||
nifoc-overlay.overlay
|
||||
];
|
||||
|
||||
config = {
|
||||
|
@ -23,25 +23,30 @@ in
|
|||
system = nixpkgs.lib.nixosSystem {
|
||||
system = default-system;
|
||||
modules = [
|
||||
../hosts/argon.nix
|
||||
{
|
||||
nixpkgs = nixpkgsConfig;
|
||||
nix = {
|
||||
registry.nixpkgs.to = { type = "path"; path = nixpkgs.outPath; };
|
||||
nixPath = nixpkgs.lib.mkForce [ "nixpkgs=flake:nixpkgs" ];
|
||||
};
|
||||
}
|
||||
|
||||
nixos-hardware.nixosModules.raspberry-pi-4
|
||||
|
||||
lix-module.nixosModules.default
|
||||
|
||||
home-manager.nixosModules.home-manager
|
||||
|
||||
agenix.nixosModules.default
|
||||
|
||||
{
|
||||
nixpkgs = nixpkgsConfig;
|
||||
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
|
||||
nix.registry.nixpkgs.flake = nixpkgs;
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
users.daniel = import ../../home/hosts/argon.nix;
|
||||
};
|
||||
}
|
||||
|
||||
agenix.nixosModules.default
|
||||
|
||||
../hosts/argon.nix
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
@ -45,8 +45,6 @@ in
|
|||
system.stateVersion = "22.11";
|
||||
|
||||
nix = {
|
||||
package = pkgs.nixVersions.stable;
|
||||
|
||||
settings = {
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
|
@ -60,6 +58,7 @@ in
|
|||
"https://attic.cache.daniel.sx/nifoc-ci?priority=35"
|
||||
"https://nix-community.cachix.org?priority=50"
|
||||
"https://cache.garnix.io?priority=60"
|
||||
"https://cache.lix.systems?priority=70"
|
||||
];
|
||||
|
||||
extra-trusted-public-keys = [
|
||||
|
@ -67,6 +66,7 @@ in
|
|||
"nifoc-ci:JpD9zqVQi8JuS7B8htPDOQZh08rhInMnGFS9RVhiuwk="
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
|
||||
"cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o="
|
||||
];
|
||||
|
||||
trusted-users = [
|
||||
|
|
Loading…
Reference in a new issue