diff --git a/README.md b/README.md index d2f11e1..cb9fcc2 100644 --- a/README.md +++ b/README.md @@ -21,12 +21,19 @@ Requires Nix-channel with [NixOS 24.11](https://nixos.org/) ## Commands -Scripts will not run unless the necessary packages have been added to the path, either in a shell or by running nixos-rebuild +First time run, will create a shell with the minimum dependencies in order to download the rest + +```Shell +nix develop . --experimental-features 'nix-command flakes' +just switch-now +``` + +Scripts below will not run unless the necessary packages have been added to the path, either in a shell or by running nixos-rebuild Format all .nix files ```Shell - ./fmt + just fmt ``` Rebuild and test Nix configuration @@ -34,7 +41,7 @@ Rebuild and test Nix configuration - Will add all new files to git and format all nix-files ```Shell - ./test + just test ``` Rebuild and switch Nix configuration @@ -42,7 +49,7 @@ Rebuild and switch Nix configuration - Will add all new files to git and format all nix-files ```Shell - ./rebuild + just switch ``` Update and switch @@ -50,5 +57,5 @@ Update and switch - Will update the flakes and nix-channel, then switch if there are no errors ```Shell - ./update + just update ``` diff --git a/flake.nix b/flake.nix index 40de615..a7484f5 100644 --- a/flake.nix +++ b/flake.nix @@ -37,14 +37,23 @@ }: let system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; inherit (self) outputs; common = import ./common.nix; in { defaultPackage.${system} = home-manager.defaultPackage.${system}; + # The minimum amount of dependencies in order to run 'just switch-now' + devShells.${system}.default = pkgs.mkShell { + packages = with pkgs; [ + just + nh + ]; + }; + # Adds the nix fmt command to format nix files - formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style; + formatter.${system} = pkgs.nixfmt-rfc-style; nixosConfigurations.${common.hostname} = nixpkgs.lib.nixosSystem { system = system; diff --git a/fmt b/fmt deleted file mode 100755 index 30cdffa..0000000 --- a/fmt +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env sh - -# Format all files matched by treefmt.toml - -treefmt --on-unmatched info diff --git a/home-manager/development/zed.nix b/home-manager/development/zed.nix index 1d1503f..af1799f 100644 --- a/home-manager/development/zed.nix +++ b/home-manager/development/zed.nix @@ -11,6 +11,7 @@ "toml" "nix" "git-firefly" + "just" ]; userSettings = let diff --git a/justfile b/justfile new file mode 100644 index 0000000..931e3dc --- /dev/null +++ b/justfile @@ -0,0 +1,24 @@ +default: + @just --list + +fmt: + treefmt --on-unmatched info + +test *FLAGS: + git add . + just fmt + nh os test . {{FLAGS}} + +switch *FLAGS: + git add . + just fmt + nh os switch . {{FLAGS}} + +switch-now *FLAGS: + nh os switch . {{FLAGS}} + +update: + nix-channel --update + nix flake update + + just switch diff --git a/modules/development.nix b/modules/development.nix index a6abd69..dc6e587 100644 --- a/modules/development.nix +++ b/modules/development.nix @@ -14,6 +14,7 @@ rustup nodejs_22 pnpm + just gcc # Required for C, Rust and others # Language servers nixd diff --git a/switch b/switch deleted file mode 100755 index 996db1e..0000000 --- a/switch +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env sh - -# Accepts all arguments to nh os switch -# For example --ask to prompt if the user want to switch configs - -# Rebuild and switch the environment if successful -git add . -./fmt -nh os switch . "$@" diff --git a/test b/test deleted file mode 100755 index 43bcfe1..0000000 --- a/test +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env sh - -# Rebuild and switch the environment if successful -git add . -./fmt -nh os test . "$@" diff --git a/update b/update deleted file mode 100755 index 514d2a9..0000000 --- a/update +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env sh - -nix-channel --update -nix flake update - -./switch