nix: switch to lix

Signed-off-by: Bloxx12 <charlie@charlieroot.dev>
Change-Id: I6a6a69641a5c002234e971b698d9164999be08f3
This commit is contained in:
Bloxx12 2025-07-21 00:06:54 +02:00
commit f4790c05ed
Signed by: faukah
SSH key fingerprint: SHA256:jpYIt4Vkz1NBTQcks/N9OPTfTFxE6KF2W/rV7hrfrIw
3 changed files with 33 additions and 117 deletions

View file

@ -1,76 +0,0 @@
{
config,
lib,
pkgs,
sources,
...
}:
let
determinate =
(import sources.flake-compat {
src = sources.determinate;
copySourceTreeToStore = false;
}).outputs;
dix =
(import sources.flake-compat {
src = determinate.inputs.nix;
copySourceTreeToStore = false;
}).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,17 +1,20 @@
# credits to raf
{
config,
sources,
lib,
pkgs,
...
}:
let
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.modules) mkForce;
lix = pkgs.callPackage "${sources.lix}/package.nix" {
stdenv = pkgs.clangStdenv;
};
in
{
nix = {
package = lix;
# Check that Nix can parse the generated nix.conf.
checkConfig = true;
@ -26,10 +29,14 @@ in
# registry =
# lib.mapAttrs (_: v: {flake = v.outPath;}) sources
# // {system.flake = sources.nichts;};
registry.nixpkgs.to = {
type = "path";
source = sources.nixpkgs;
};
# Add inputs to the system's legacy channels
# to make legacy nix commands consistent as well
nixPath = mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry;
nixPath = [ "nixpkgs=/etc/nixos/nixpkgs" ];
# Run the Nix daemon on lowest possible priority
daemonCPUSchedPolicy = "idle";
@ -116,7 +123,7 @@ in
"flakes" # flakes
"nix-command" # experimental nix commands
"cgroups" # allow nix to execute builds inside cgroups
"pipe-operators"
"pipe-operator"
];
# Ensures that the result of Nix expressions is fully determined by
@ -168,6 +175,9 @@ in
};
};
environment.etc = {
"nixos/nixpkgs".source = builtins.storePath sources.nixpkgs;
};
systemd.services = {
# WE DONT WANT TO BUILD STUFF ON TMPFS
# ITS NOT A GOOD IDEA