use nh and flake-compatish to skip copying source to store
7 files changed, 50 insertions(+), 12 deletions(-)
A default.nix
@@ -0,0 +1,12 @@ +let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + flake-compatish = import (fetchTree lock.nodes.flake-compatish.locked); + flake = flake-compatish { + source = ./.; + overrides = { + # Path: use directly without store copy (fast local dev) + self = ./.; + }; + }; +in +flake.impure
M flake.lock → flake.lock
@@ -125,6 +125,21 @@ "repo": "flake-compat", "type": "github" } }, + "flake-compatish": { + "locked": { + "lastModified": 1771176559, + "narHash": "sha256-V07a8KsYGj8nvMuBfF7PO88Tzqg3LJjxuIasgR5Mx3o=", + "owner": "lillecarl", + "repo": "flake-compatish", + "rev": "d8c944d4df613d47a3dc7b800c7531c33323c845", + "type": "github" + }, + "original": { + "owner": "lillecarl", + "repo": "flake-compatish", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [@@ -757,6 +772,7 @@ "agenix": "agenix", "angrr": "angrr", "darwin": "darwin", "elgit": "elgit", + "flake-compatish": "flake-compatish", "home-manager": "home-manager", "minimal-emacs": "minimal-emacs", "mycal": "mycal",
M flake.nix → flake.nix
@@ -1,5 +1,6 @@ { inputs = { + flake-compatish.url = "github:lillecarl/flake-compatish"; srvos = { url = "github:nix-community/srvos"; };@@ -199,11 +200,8 @@ in { default = pkgs.mkShellNoCC { packages = with pkgs; [ + nh nixos-option - nixos-rebuild-ng - (writeShellScriptBin "nixos-rebuild" '' - exec ${lib.getExe nixos-rebuild-ng} "$@" - '') vpsfree-client ]; };
M justfile → justfile
@@ -1,19 +1,22 @@ flake := ".?submodules=1" +user := env("USER", "alin") +hostname := env("hostname", env("HOSTNAME", `hostname`)) +export NH_FILE := "." test: nix flake check --all-systems {{ flake }} build *args: - home-manager switch --flake {{ flake }} {{ args }} + nh home switch --file . "homeConfigurations.{{ user }}@{{ hostname }}" {{ args }} run action="switch" *args: #!/usr/bin/env fish set --local os $(string split -- - $system)[-1] switch $os: case "darwin": - sudo darwin-rebuild {{ action }} --flake {{ flake }}#{$hostname} {{ args }} + nh darwin {{ action }} --file . darwinConfigurations.{{ hostname }} {{ args }} case "linux": - nixos-rebuild {{ action }} --flake {{ flake }}#{$hostname} --sudo {{ args }} + nh os {{ action }} --file . nixosConfigurations.{{ hostname }} {{ args }} case *: - + echo "Couldn't find a supported os in \$system: $system" end
M scripts/os/update/smrk → scripts/os/update/smrk
@@ -16,11 +16,11 @@ if set --query _flag_remote; or set --query _flag_build_host set --function build_host_arg --build-host $build_host[1] end -nixos-rebuild $action \ - --flake .?submodules=1#{$target} \ +nh os $action \ + --file . nixosConfigurations.{$target} \ $build_host_arg \ + --use-substitutes \ --target-host {$target} \ - --no-reexec \ --show-trace \ - --sudo \ + --elevation-strategy=passwordless \ $argv_opts
M system/settings/programs/base.nix → system/settings/programs/base.nix
@@ -12,6 +12,7 @@ brotli lzop zstd pwgen-secure + nix-output-monitor ] ++ (lib.optionals (stdenv.isLinux) [ psmisc
M user/settings/nix.nix → user/settings/nix.nix
@@ -14,6 +14,14 @@ assumeXdg = true; }; programs.direnv.nix-direnv.package = lixPackageSet.nix-direnv; + programs.nh = { + enable = true; + clean = { + enable = true; + extraArgs = "--keep 10 --keep-since 5d"; + }; + }; + home.packages = with pkgs; [ angrr nix-tree