Merge remote-tracking branch 'origin/main' into thinkpad

This commit is contained in:
Martin Berg Alstad 2025-02-14 16:55:30 +01:00
commit 223545ba1d
Signed by: martials
GPG Key ID: 848D71DE0590C199
9 changed files with 48 additions and 32 deletions

View File

@ -21,12 +21,19 @@ Requires Nix-channel with [NixOS 24.11](https://nixos.org/)
## Commands ## 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 Format all .nix files
```Shell ```Shell
./fmt just fmt
``` ```
Rebuild and test Nix configuration 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 - Will add all new files to git and format all nix-files
```Shell ```Shell
./test just test
``` ```
Rebuild and switch Nix configuration 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 - Will add all new files to git and format all nix-files
```Shell ```Shell
./rebuild just switch
``` ```
Update and 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 - Will update the flakes and nix-channel, then switch if there are no errors
```Shell ```Shell
./update just update
``` ```

View File

@ -37,14 +37,23 @@
}: }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
inherit (self) outputs; inherit (self) outputs;
common = import ./common.nix; common = import ./common.nix;
in in
{ {
defaultPackages.${system} = home-manager.defaultPackage.${system}; defaultPackages.${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 # 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 { nixosConfigurations.${common.hostname} = nixpkgs.lib.nixosSystem {
system = system; system = system;

5
fmt
View File

@ -1,5 +0,0 @@
#!/usr/bin/env sh
# Format all files matched by treefmt.toml
treefmt --on-unmatched info

View File

@ -11,6 +11,7 @@
"toml" "toml"
"nix" "nix"
"git-firefly" "git-firefly"
"just"
]; ];
userSettings = userSettings =
let let

24
justfile Normal file
View 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

View File

@ -14,6 +14,7 @@
rustup rustup
nodejs_22 nodejs_22
pnpm pnpm
just
gcc # Required for C, Rust and others gcc # Required for C, Rust and others
# Language servers # Language servers
nixd nixd

9
switch
View File

@ -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
View File

@ -1,6 +0,0 @@
#!/usr/bin/env sh
# Rebuild and switch the environment if successful
git add .
./fmt
nh os test . "$@"

6
update
View File

@ -1,6 +0,0 @@
#!/usr/bin/env sh
nix-channel --update
nix flake update
./switch