Improved flake-compat

Get the rev from the flake.lock file. Shouldn't be an issue for
first time users as the guide instructs users to generate a lock
file. `builtins.file` was used in accordance with nix.dev
reccommendations.

https://nix.dev/anti-patterns/language#reproducibility-referencing-top-level-directory-with

Rm tempfix
This commit is contained in:
teutat3s 2022-11-07 11:24:59 +01:00 committed by Benjamin Bädorf
parent b3f4727354
commit 7655260456
No known key found for this signature in database
GPG key ID: 4406E80E13CD656C
3 changed files with 7 additions and 19 deletions

View file

@ -12,6 +12,9 @@
latest.url = "github:nixos/nixpkgs/nixos-unstable"; latest.url = "github:nixos/nixpkgs/nixos-unstable";
fork.url = "github:teutat3s/nixpkgs/fix/gitea-needs-gpg-in-path"; fork.url = "github:teutat3s/nixpkgs/fix/gitea-needs-gpg-in-path";
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
digga.url = "github:pub-solar/digga/fix/bootstrap-iso"; digga.url = "github:pub-solar/digga/fix/bootstrap-iso";
digga.inputs.nixpkgs.follows = "nixos"; digga.inputs.nixpkgs.follows = "nixos";
digga.inputs.nixlib.follows = "nixos"; digga.inputs.nixlib.follows = "nixos";

View file

@ -1,14 +1,14 @@
let let
rev = "e7e5d481a0e15dcd459396e55327749989e04ce0"; lock = builtins.fromJSON (builtins.readFile builtins.path { path = ../../flake.lock; name = "lockPath"; });
flake = (import flake = (import
( (
fetchTarball { fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz"; url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = "0zd3x46fswh5n6faq4x2kkpy6p3c6j593xbdlbsl40ppkclwc80x"; sha256 = lock.nodes.flake-compat.locked.narHash;
} }
) )
{ {
src = ../../.; src = builtins.path { path = ../../.; name = "projectRoot"; };
}); });
in in
flake flake

View file

@ -28,21 +28,6 @@ in
# override for our own welcome # override for our own welcome
devshell.name = pkgs.lib.mkForce "PubSolarOS"; devshell.name = pkgs.lib.mkForce "PubSolarOS";
# tempfix: remove when merged https://github.com/numtide/devshell/pull/123
devshell.startup.load_profiles = pkgs.lib.mkForce (pkgs.lib.noDepEntry ''
# PATH is devshell's exorbitant privilige:
# fence against its pollution
_PATH=''${PATH}
# Load installed profiles
for file in "$DEVSHELL_DIR/etc/profile.d/"*.sh; do
# If that folder doesn't exist, bash loves to return the whole glob
[[ -f "$file" ]] && source "$file"
done
# Exert exorbitant privilige and leave no trace
export PATH=''${_PATH}
unset _PATH
'');
commands = with pkgs; [ commands = with pkgs; [
(devos nix) (devos nix)
(devos agenix) (devos agenix)