summaryrefslogtreecommitdiff
path: root/templates/nixos
diff options
context:
space:
mode:
Diffstat (limited to 'templates/nixos')
-rw-r--r--templates/nixos/flake.nix4
-rw-r--r--templates/nixos/justfile44
2 files changed, 34 insertions, 14 deletions
diff --git a/templates/nixos/flake.nix b/templates/nixos/flake.nix
index a8c2e09..235ce27 100644
--- a/templates/nixos/flake.nix
+++ b/templates/nixos/flake.nix
@@ -19,14 +19,14 @@
forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
in {
- nixosConfigurations."myHostname" = nixpkgs.lib.nixosSystem {
+ nixosConfigurations.myComputer = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [./configuration.nix];
specialArgs = {inherit inputs;};
};
devShells = forAllSystems (pkgs: {
- default = pkgs.mkShell {
+ default = pkgs.mkShellNoCC {
packages = with pkgs; [
just
fzf
diff --git a/templates/nixos/justfile b/templates/nixos/justfile
index 4964484..7c44f0d 100644
--- a/templates/nixos/justfile
+++ b/templates/nixos/justfile
@@ -1,31 +1,51 @@
alias b := build
+alias c := check
alias dr := dry-run
alias sw := switch
alias t := test
alias u := update
+alias ui := update-input
rebuildArgs := "--verbose"
rebuild := if os() == "macos" { "darwin-rebuild" } else { "nixos-rebuild" }
-asRoot := if os() == "linux" { "true" } else { "false" }
default:
@just --choose
[private]
-rebuild subcmd root="false":
- {{ if root == "true" { "sudo " } else { "" } }}{{ rebuild }} {{ subcmd }} {{ rebuildArgs }} --flake .
+rebuild subcmd *extraArgs="":
+ {{ rebuild }} {{ subcmd }} {{ rebuildArgs }} --flake . {{ extraArgs }}
-build:
- @just rebuild build
+boot *extraArgs="": (rebuild "boot" extraArgs)
-dry-run:
- @just rebuild dry-run
+build *extraArgs="": (rebuild "build" extraArgs)
-switch:
- @just rebuild switch {{ asRoot }}
+dry-run *extraArgs="": (rebuild "dry-run" extraArgs)
-test:
- @just rebuild test {{ asRoot }}
+switch *extraArgs="": (rebuild "switch" extraArgs)
+
+test *extraArgs="": (rebuild "test" extraArgs)
+
+check *args="":
+ nix flake check \
+ --print-build-logs \
+ --show-trace \
+ --accept-flake-config \
+ {{ args }}
+
+eval system *args="":
+ nix eval \
+ --raw \
+ '.#nixosConfigurations.{{ system }}.config.system.build.toplevel' \
+ {{ args }}
update:
- nix flake update --commit-lock-file
+ nix flake update \
+ --commit-lock-file \
+ --commit-lockfile-summary "flake: update all inputs"
+
+update-input input:
+ nix flake lock \
+ --update-input {{ input }} \
+ --commit-lock-file \
+ --commit-lockfile-summary "flake: update {{ input }}"