flake: sitch 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 2e7d11c2ed
Signed by: faukah
SSH key fingerprint: SHA256:jpYIt4Vkz1NBTQcks/N9OPTfTFxE6KF2W/rV7hrfrIw
24 changed files with 707 additions and 731 deletions

View file

@ -1,8 +1,8 @@
{
config,
inputs,
lib,
pkgs,
sources,
...
}: let
inherit (lib.modules) mkIf;
@ -12,7 +12,7 @@
in {
options.modules.system.boot.lanzaboote.enable = mkEnableOption "Lanzaboote";
imports = [
inputs.lanzaboote.nixosModules.lanzaboote
(sources.lanzaboote + "/nix/modules/lanzaboote.nix")
];
config = mkIf cfg.enable {

View file

@ -1,6 +1,6 @@
{
config,
inputs,
sources,
lib,
pkgs,
...
@ -8,7 +8,7 @@
inherit (lib.modules) mkDefault;
in {
imports = [
inputs.watt.nixosModules.default
# (sources.watt + "/nix/module.nix")
];
config = {
environment.systemPackages = builtins.attrValues {
@ -29,182 +29,182 @@ in {
hardware.acpilight.enable = false;
services.watt = {
enable = true;
# sample config from https://github.com/NotAShelf/watt#sample-configuration
settings = {
rule = [
{
cpu = {
energy-performance-preference = "power";
frequency-mhz-maximum = 2000;
governor = "powersave";
turbo = false;
};
"if" = {
is-more-than = 85;
value = "$cpu-temperature";
};
priority = 100;
}
{
cpu = {
energy-performance-preference = "power";
frequency-mhz-maximum = 800;
governor = "powersave";
turbo = false;
};
"if" = {
all = [
"?discharging"
{
is-less-than = 0.3;
value = "%power-supply-charge";
}
];
};
power = {platform-profile = "low-power";};
priority = 90;
}
{
cpu = {
energy-performance-preference = "performance";
governor = "performance";
turbo = true;
};
"if" = {
all = [
{
is-more-than = 0.8;
value = "%cpu-usage";
}
{
is-less-than = 30;
value = "$cpu-idle-seconds";
}
{
is-less-than = 75;
value = "$cpu-temperature";
}
];
};
priority = 80;
}
{
cpu = {
energy-performance-bias = "balance_performance";
energy-performance-preference = "performance";
governor = "performance";
turbo = true;
};
"if" = {
all = [
{not = "?discharging";}
{
is-more-than = 0.1;
value = "%cpu-usage";
}
{
is-less-than = 80;
value = "$cpu-temperature";
}
];
};
priority = 70;
}
{
cpu = {
energy-performance-preference = "balance_performance";
governor = "schedutil";
};
"if" = {
all = [
{
is-more-than = 0.4;
value = "%cpu-usage";
}
{
is-less-than = 0.8;
value = "%cpu-usage";
}
];
};
priority = 60;
}
{
cpu = {
energy-performance-preference = "power";
governor = "powersave";
turbo = false;
};
"if" = {
all = [
{
is-less-than = 0.2;
value = "%cpu-usage";
}
{
is-more-than = 60;
value = "$cpu-idle-seconds";
}
];
};
priority = 50;
}
{
cpu = {
energy-performance-preference = "power";
frequency-mhz-maximum = 1600;
governor = "powersave";
turbo = false;
};
"if" = {
is-more-than = 300;
value = "$cpu-idle-seconds";
};
priority = 40;
}
{
cpu = {
energy-performance-preference = "power";
frequency-mhz-maximum = 2000;
governor = "powersave";
turbo = false;
};
"if" = {
all = [
"?discharging"
{
is-less-than = 0.5;
value = "%power-supply-charge";
}
];
};
power = {platform-profile = "low-power";};
priority = 30;
}
{
cpu = {
energy-performance-bias = "balance_power";
energy-performance-preference = "power";
frequency-mhz-maximum = 1800;
frequency-mhz-minimum = 200;
governor = "powersave";
turbo = false;
};
"if" = "?discharging";
priority = 20;
}
{
cpu = {
energy-performance-preference = "balance_performance";
governor = "schedutil";
};
priority = 0;
}
];
};
};
# services.watt = {
# enable = true;
# # sample config from https://github.com/NotAShelf/watt#sample-configuration
# settings = {
# rule = [
# {
# cpu = {
# energy-performance-preference = "power";
# frequency-mhz-maximum = 2000;
# governor = "powersave";
# turbo = false;
# };
# "if" = {
# is-more-than = 85;
# value = "$cpu-temperature";
# };
# priority = 100;
# }
# {
# cpu = {
# energy-performance-preference = "power";
# frequency-mhz-maximum = 800;
# governor = "powersave";
# turbo = false;
# };
# "if" = {
# all = [
# "?discharging"
# {
# is-less-than = 0.3;
# value = "%power-supply-charge";
# }
# ];
# };
# power = {platform-profile = "low-power";};
# priority = 90;
# }
# {
# cpu = {
# energy-performance-preference = "performance";
# governor = "performance";
# turbo = true;
# };
# "if" = {
# all = [
# {
# is-more-than = 0.8;
# value = "%cpu-usage";
# }
# {
# is-less-than = 30;
# value = "$cpu-idle-seconds";
# }
# {
# is-less-than = 75;
# value = "$cpu-temperature";
# }
# ];
# };
# priority = 80;
# }
# {
# cpu = {
# energy-performance-bias = "balance_performance";
# energy-performance-preference = "performance";
# governor = "performance";
# turbo = true;
# };
# "if" = {
# all = [
# {not = "?discharging";}
# {
# is-more-than = 0.1;
# value = "%cpu-usage";
# }
# {
# is-less-than = 80;
# value = "$cpu-temperature";
# }
# ];
# };
# priority = 70;
# }
# {
# cpu = {
# energy-performance-preference = "balance_performance";
# governor = "schedutil";
# };
# "if" = {
# all = [
# {
# is-more-than = 0.4;
# value = "%cpu-usage";
# }
# {
# is-less-than = 0.8;
# value = "%cpu-usage";
# }
# ];
# };
# priority = 60;
# }
# {
# cpu = {
# energy-performance-preference = "power";
# governor = "powersave";
# turbo = false;
# };
# "if" = {
# all = [
# {
# is-less-than = 0.2;
# value = "%cpu-usage";
# }
# {
# is-more-than = 60;
# value = "$cpu-idle-seconds";
# }
# ];
# };
# priority = 50;
# }
# {
# cpu = {
# energy-performance-preference = "power";
# frequency-mhz-maximum = 1600;
# governor = "powersave";
# turbo = false;
# };
# "if" = {
# is-more-than = 300;
# value = "$cpu-idle-seconds";
# };
# priority = 40;
# }
# {
# cpu = {
# energy-performance-preference = "power";
# frequency-mhz-maximum = 2000;
# governor = "powersave";
# turbo = false;
# };
# "if" = {
# all = [
# "?discharging"
# {
# is-less-than = 0.5;
# value = "%power-supply-charge";
# }
# ];
# };
# power = {platform-profile = "low-power";};
# priority = 30;
# }
# {
# cpu = {
# energy-performance-bias = "balance_power";
# energy-performance-preference = "power";
# frequency-mhz-maximum = 1800;
# frequency-mhz-minimum = 200;
# governor = "powersave";
# turbo = false;
# };
# "if" = "?discharging";
# priority = 20;
# }
# {
# cpu = {
# energy-performance-preference = "balance_performance";
# governor = "schedutil";
# };
# priority = 0;
# }
# ];
# };
# };
services = {
upower = {
enable = true;

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 = {

View file

@ -2,6 +2,7 @@
inputs,
config,
lib,
sources,
...
}: let
inherit (lib.modules) mkIf mkForce;
@ -10,7 +11,7 @@
cfg = config.modules.system.impermanence;
in {
imports = [
inputs.impermanence.nixosModules.impermanence
(sources.impermanence + "/nixos.nix")
];
config = mkIf cfg.enable {
users = {