env: add simple env to test out buildEnv and profiles

This commit is contained in:
Primrose 2025-05-10 19:27:01 +02:00
parent a37ac14681
commit 6b71947f89
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
2 changed files with 23 additions and 0 deletions

View file

@ -17,6 +17,18 @@ install host:
--file ./default.nix \ --file ./default.nix \
--attr "nixosConfigurations.{{ host }}" --attr "nixosConfigurations.{{ host }}"
env name action profilePath="~/.environments":
#!/usr/bin/env bash
# 1) realize the buildEnv derivation
# 2) set the environment to it
drv=$(nix-build -E "
let sources = import ./nix/sources.nix {};
pkgs = import sources.nixpkgs {};
in pkgs.callPackage ./nix/environments/{{ name }}.nix {}
")
mkdir -p {{ profilePath }}
nix-env --{{ action }} "$drv" --profile {{ profilePath }}"/{{ name }}"
update: update:
niv update nixpkgs niv update nixpkgs
niv update nur niv update nur

11
nix/environments/nix.nix Normal file
View file

@ -0,0 +1,11 @@
{
buildEnv,
#
nixfmt-rfc-style,
}:
buildEnv {
name = "nix";
paths = [
nixfmt-rfc-style
];
}