>_ Replaced shell scripts with justfile, nix shell to download the rest
This commit is contained in:
parent
0b0d93cf41
commit
0825b293a1
17
README.md
17
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
|
||||
```
|
||||
|
11
flake.nix
11
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;
|
||||
|
5
fmt
5
fmt
@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Format all files matched by treefmt.toml
|
||||
|
||||
treefmt --on-unmatched info
|
@ -11,6 +11,7 @@
|
||||
"toml"
|
||||
"nix"
|
||||
"git-firefly"
|
||||
"just"
|
||||
];
|
||||
userSettings =
|
||||
let
|
||||
|
24
justfile
Normal file
24
justfile
Normal file
@ -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
|
@ -14,6 +14,7 @@
|
||||
rustup
|
||||
nodejs_22
|
||||
pnpm
|
||||
just
|
||||
gcc # Required for C, Rust and others
|
||||
# Language servers
|
||||
nixd
|
||||
|
9
switch
9
switch
@ -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 . "$@"
|
6
test
6
test
@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Rebuild and switch the environment if successful
|
||||
git add .
|
||||
./fmt
|
||||
nh os test . "$@"
|
Loading…
x
Reference in New Issue
Block a user