Skip to content

Commit

Permalink
[nix] system wide channels & registry + gc
Browse files Browse the repository at this point in the history
  • Loading branch information
ejiek committed Oct 30, 2023
1 parent e4fdc6e commit bfcca62
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
25 changes: 23 additions & 2 deletions configuration.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# configuration in this file is shared by all hosts

{ pkgs, ... }: {
{
inputs,
lib,
pkgs,
... }: {

users.users = {
root = {
Expand Down Expand Up @@ -39,7 +43,24 @@

boot.zfs.forceImportRoot = false;

nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix = {
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};

registry = lib.mapAttrs (_: value: { flake = value; }) inputs;

nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") pkgs.config.nix.registry;

settings = {
experimental-features = [ "nix-command" "flakes" ];

keep-outputs = true;
keep-derivations = true;
};
};

programs.git.enable = true;

Expand Down
13 changes: 11 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
};

outputs = { self, nixpkgs, home-manager, nixos-hardware, rust-overlay }:
outputs = { self
, nixpkgs
, home-manager
, nixos-hardware
, rust-overlay
, ...
} @ inputs:
let
mkHost = hostName: system:
(({ my-config, zfs-root, pkgs, system, ... }:
Expand Down Expand Up @@ -57,7 +63,10 @@
}

# Shared config
(import ./configuration.nix { inherit pkgs; })
(import ./configuration.nix {
inherit pkgs inputs;
lib = nixpkgs.lib;
})
];
})

Expand Down

0 comments on commit bfcca62

Please sign in to comment.