NixOS and Home Manager config

feat: modular nix config

nel.pet ea096021 48d220a6

verified
Changed files
+58 -5
modules
systems
nel-desktop
+7
modules/nixos/default.nix
···
+
{
+
_class = "nixos";
+
+
imports = [
+
./nix.nix
+
];
+
}
+50
modules/nixos/nix.nix
···
+
{ inputs, lib, ... }: {
+
nix = {
+
# Add all flake inputs to the system flake registry. There are probably better ways to do this.
+
# Particularly to consider https://github.com/NixOS/nixpkgs/pull/388090 (thank isabels config for pointing that out)
+
# but thats an issue for future me.
+
registry = let
+
# rename self to cyclamen
+
inputs' = lib.filterAttrs (
+
name: value:
+
if name == "self"
+
then false
+
else true
+
) (inputs // {cyclamen = inputs.self;});
+
in (
+
lib.mapAttrs (name: value: {
+
to = {
+
type = "path";
+
path = value;
+
};
+
}) inputs'
+
);
+
+
# Dont need or want that.
+
channel.enable = false;
+
+
gc = {
+
automatic = true;
+
options = "--delete-older-than 14d";
+
};
+
+
settings = {
+
allowed-users = [ "@wheel" ];
+
trusted-users = [ "@wheel" ];
+
+
experimental-features = [
+
# Enable flakes
+
"nix-command" "flakes"
+
];
+
+
# Disable the global flake registry
+
flake-registry = "";
+
+
# Use as many jobs are there are CPU cores available (speed up builds)
+
max-jobs = "auto";
+
+
# Use $XDG_STATE_HOME/nix instead of ~/.nix-profile and co
+
use-xdg-base-directories = true;
+
};
+
};
+
}
+1 -5
systems/nel-desktop/configuration.nix
···
{ ... }: {
imports = [
+
../../modules/nixos
./hardware-configuration.nix
];
···
networking.hostName = "nel-desktop";
networking.networkmanager.enable = true;
-
-
nix.settings = {
-
experimental-features = [ "nix-command" "flakes" ];
-
use-xdg-base-directories = true;
-
};
programs.partition-manager.enable = true;
services.flatpak.enable = true;