forked from pub-solar/os
core: pin registry by ref
Users may wish to change the default value of override and nixos inputs. If they do so, we want the registry listing to reflect the proper ref names afterwards. Also create a shell alias to easily search every flake in nix.registry.
This commit is contained in:
parent
bf34d2071f
commit
3a735ce70b
|
@ -1,11 +1,12 @@
|
|||
{ lib
|
||||
{ extern
|
||||
, home
|
||||
, lib
|
||||
, nixos
|
||||
, override
|
||||
, nixos-hardware
|
||||
, override
|
||||
, pkgs
|
||||
, self
|
||||
, system
|
||||
, extern
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
|
@ -36,24 +37,52 @@ let
|
|||
modules;
|
||||
};
|
||||
|
||||
global = {
|
||||
global =
|
||||
let
|
||||
inherit (lock) nodes;
|
||||
|
||||
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
|
||||
in
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
|
||||
hardware.enableRedistributableFirmware = lib.mkDefault true;
|
||||
|
||||
networking.hostName = hostName;
|
||||
|
||||
nix.nixPath = [
|
||||
"nixos-unstable=${override}"
|
||||
"nixos=${nixos}"
|
||||
"nixpkgs=${nixos}"
|
||||
"nixos-config=${self}/compat/nixos"
|
||||
"home-manager=${home}"
|
||||
];
|
||||
|
||||
nixpkgs = { inherit pkgs; };
|
||||
|
||||
nix.registry = {
|
||||
nixflk.flake = self;
|
||||
nixpkgs.flake = nixos;
|
||||
flk.flake = self;
|
||||
|
||||
nixos = {
|
||||
exact = true;
|
||||
from = nodes.nixos.original;
|
||||
to = {
|
||||
inherit (nixos) lastModified narHash rev;
|
||||
|
||||
path = override.outPath;
|
||||
type = "path";
|
||||
};
|
||||
};
|
||||
|
||||
override = {
|
||||
exact = true;
|
||||
from = nodes.override.original;
|
||||
to = {
|
||||
inherit (override) lastModified narHash rev;
|
||||
|
||||
path = override.outPath;
|
||||
type = "path";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
system.configurationRevision = lib.mkIf (self ? rev) self.rev;
|
||||
|
|
|
@ -65,8 +65,8 @@ in
|
|||
nr = "np remove";
|
||||
ns = "n search --no-update-lock-file";
|
||||
nf = "n flake";
|
||||
nepl = "n repl '<nixos>'";
|
||||
srch = "ns nixpkgs";
|
||||
nepl = "n repl '<nixpkgs>'";
|
||||
srch = "nsni";
|
||||
nrb = ifSudo "sudo nixos-rebuild";
|
||||
mn = ''
|
||||
manix "" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | sk --preview="manix '{}'" | xargs manix
|
||||
|
@ -93,7 +93,20 @@ in
|
|||
dn = ifSudo "s systemctl stop";
|
||||
jtl = "journalctl";
|
||||
|
||||
};
|
||||
} // lib.mapAttrs'
|
||||
(n: v:
|
||||
let
|
||||
prefix = lib.concatStrings (lib.take 2 (lib.stringToCharacters n));
|
||||
ref = from:
|
||||
if from ? ref
|
||||
then "ns ${from.id}/${from.ref}"
|
||||
else "ns ${from.id}";
|
||||
in
|
||||
lib.nameValuePair
|
||||
"ns${prefix}"
|
||||
(ref v.from)
|
||||
)
|
||||
config.nix.registry;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue