From d0a57deacd48de1ed19bbdc2cfe9de0c17c3c9bf Mon Sep 17 00:00:00 2001 From: cnst Date: Wed, 31 Jul 2024 18:17:39 +0200 Subject: [PATCH] .. --- nixos/core/default.nix | 2 +- nixos/core/system/default.nix | 37 ++++++++++++++++++++++++++++++ nixos/core/system/nh.nix | 13 +++++++++++ nixos/core/system/nixpkgs.nix | 13 +++++++++++ nixos/core/system/substituters.nix | 28 ++++++++++++++++++++++ 5 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 nixos/core/system/default.nix create mode 100644 nixos/core/system/nh.nix create mode 100644 nixos/core/system/nixpkgs.nix create mode 100644 nixos/core/system/substituters.nix diff --git a/nixos/core/default.nix b/nixos/core/default.nix index cb2df4df..dd13017e 100644 --- a/nixos/core/default.nix +++ b/nixos/core/default.nix @@ -1,6 +1,6 @@ {pkgs, ...}: { imports = [ - ./nix + ./system ./xdg.nix ./zsh.nix ./fonts.nix diff --git a/nixos/core/system/default.nix b/nixos/core/system/default.nix new file mode 100644 index 00000000..2a858f65 --- /dev/null +++ b/nixos/core/system/default.nix @@ -0,0 +1,37 @@ +{ + inputs, + lib, + config, + pkgs, + ... +}: { + imports = [ + ./nh.nix + ./substituters.nix + ./nixpkgs.nix + ]; + + environment.systemPackages = [pkgs.git]; + + nix = { + # pin the registry to avoid downloading and evaling a new nixpkgs version every time + registry = lib.mapAttrs (_: v: {flake = v;}) inputs; + + # set the path for channels compat + nixPath = lib.mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry; + + settings = { + auto-optimise-store = true; + builders-use-substitutes = true; + warn-dirty = false; + experimental-features = ["nix-command" "flakes"]; + flake-registry = "/etc/nix/registry.json"; + + # for direnv GC roots + keep-derivations = true; + keep-outputs = true; + + trusted-users = ["root" "@wheel"]; + }; + }; +} diff --git a/nixos/core/system/nh.nix b/nixos/core/system/nh.nix new file mode 100644 index 00000000..5ac2e179 --- /dev/null +++ b/nixos/core/system/nh.nix @@ -0,0 +1,13 @@ +let + homeDir = builtins.getEnv "HOME"; +in { + environment.variables.FLAKE = "${homeDir}/.nix-config"; + programs = { + nh = { + enable = true; + clean.enable = true; + clean.extraArgs = "--keep-since 4d --keep 3"; + flake = "${homeDir}/.nix-config"; + }; + }; +} diff --git a/nixos/core/system/nixpkgs.nix b/nixos/core/system/nixpkgs.nix new file mode 100644 index 00000000..7a31be8f --- /dev/null +++ b/nixos/core/system/nixpkgs.nix @@ -0,0 +1,13 @@ +{ + nixpkgs = { + overlays = [ + (_: prev: { + python312 = prev.python312.override {packageOverrides = _: pysuper: {nose = pysuper.pynose;};}; + }) + ]; + config = { + allowUnfree = true; + input-fonts.acceptLicense = true; + }; + }; +} diff --git a/nixos/core/system/substituters.nix b/nixos/core/system/substituters.nix new file mode 100644 index 00000000..a892de4e --- /dev/null +++ b/nixos/core/system/substituters.nix @@ -0,0 +1,28 @@ +{ + nix.settings = { + substituters = [ + # high priority since it's almost always used + "https://cache.nixos.org?priority=10" + + "https://anyrun.cachix.org" + "https://fufexan.cachix.org" + "https://helix.cachix.org" + "https://hyprland.cachix.org" + "https://nix-community.cachix.org" + "https://nix-gaming.cachix.org" + "https://yazi.cachix.org" + ]; + + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + + "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s=" + "fufexan.cachix.org-1:LwCDjCJNJQf5XD2BV+yamQIMZfcKWR9ISIFy5curUsY=" + "helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs=" + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" + "yazi.cachix.org-1:Dcdz63NZKfvUCbDGngQDAZq6kOroIrFoyO064uvLh8k=" + ]; + }; +}