flake: switch to npins

Signed-off-by: Bloxx12 <charlie@charlieroot.dev>
Change-Id: I6a6a6964f4aa3349951fe7574622564452ad1af1
This commit is contained in:
Bloxx12 2025-07-19 21:51:37 +02:00
commit 0b82c15255
Signed by: faukah
SSH key fingerprint: SHA256:jpYIt4Vkz1NBTQcks/N9OPTfTFxE6KF2W/rV7hrfrIw
24 changed files with 707 additions and 731 deletions

View file

@ -0,0 +1,61 @@
{
config,
lib,
pkgs,
sources,
...
}: let
determinate = (import sources.flake-compat {src = sources.determinate;}).outputs;
dix = (import sources.flake-compat {src = determinate.inputs.nix;}).outputs.packages.${pkgs.stdenv.system}.nix;
# Stronger than mkDefault (1000), weaker than mkForce (50) and the "default override priority"
# (100).
mkPreferable = lib.mkOverride 750;
# Stronger than the "default override priority", as the upstream module uses that, and weaker than mkForce (50).
mkMorePreferable = lib.mkOverride 75;
in {
config = {
nix = {
package = dix;
};
environment.systemPackages = [
determinate.packages.${pkgs.stdenv.system}.default
];
# NOTE(cole-h): Move the generated nix.conf to /etc/nix/nix.custom.conf, which is included from
# the Determinate Nixd-managed /etc/nix/nix.conf.
environment.etc."nix/nix.conf".target = "nix/nix.custom.conf";
systemd = {
services.nix-daemon.serviceConfig = {
ExecStart = [
""
"@${determinate.packages.${pkgs.stdenv.system}.default}/bin/determinate-nixd determinate-nixd --nix-bin ${config.nix.package}/bin daemon"
];
KillMode = mkPreferable "process";
LimitNOFILE = mkMorePreferable 1048576;
LimitSTACK = mkPreferable "64M";
TasksMax = mkPreferable 1048576;
};
sockets = {
nix-daemon.socketConfig.FileDescriptorName = "nix-daemon.socket";
determinate-nixd = {
description = "Determinate Nixd Daemon Socket";
wantedBy = ["sockets.target"];
before = ["multi-user.target"];
unitConfig = {
RequiresMountsFor = ["/nix/store" "/nix/var/determinate"];
};
socketConfig = {
Service = "nix-daemon.service";
FileDescriptorName = "determinate-nixd.socket";
ListenStream = "/nix/var/determinate/determinate-nixd.socket";
DirectoryMode = "0755";
};
};
};
};
};
}

View file

@ -1,7 +1,7 @@
# credits to raf
{
config,
inputs,
sources,
lib,
pkgs,
...
@ -9,10 +9,6 @@
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.modules) mkForce;
in {
imports = [
inputs.determinate.nixosModules.default
];
nix = {
# Check that Nix can parse the generated nix.conf.
checkConfig = true;
@ -25,9 +21,9 @@ in {
# this is taken from sioodmy.
# pin the registry to avoid downloading and evaling a new nixpkgs version every time
registry =
lib.mapAttrs (_: v: {flake = v;}) inputs
// {system.flake = inputs.self;};
# registry =
# lib.mapAttrs (_: v: {flake = v.outPath;}) sources
# // {system.flake = sources.nichts;};
# Add inputs to the system's legacy channels
# to make legacy nix commands consistent as well
@ -157,7 +153,7 @@ in {
];
# Determinate nix config
# ===========================================
lazy-trees = true;
# lazy-trees = true;
# ===========================================
};
};

View file

@ -1,8 +1,14 @@
# taken from raf
{
{sources, ...}: {
# Global nixpkgs configuration.
# This is ignored if nixpkgs.pkgs is set, which should be avoided.
nixpkgs = {
flake = {
source = sources.nixpkgs;
setFlakeRegistry = true;
setNixPath = true;
};
# Configuration reference:
# <https://nixos.org/manual/nixpkgs/unstable/#chap-packageconfig>
config = {