From 1b8721c683c197bf7aeb4c79583de248506d14ae Mon Sep 17 00:00:00 2001 From: Jimbo Date: Tue, 3 Sep 2024 01:01:58 -0400 Subject: [PATCH] Forcing unstable does not work well with setting nix paths, separate that into its own nix file --- flake.nix | 6 +++--- nixos/base.nix | 19 +++---------------- nixos/desktop.nix | 1 + nixos/modules/legacy.nix | 16 ++++++++++++++++ nixos/server.nix | 1 + 5 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 nixos/modules/legacy.nix diff --git a/flake.nix b/flake.nix index e99fb9a..c998c9c 100644 --- a/flake.nix +++ b/flake.nix @@ -61,7 +61,7 @@ nixos-mailserver.nixosModule ]; }; - JimDeck = nixpkgs-unstable.lib.nixosSystem { + JimDeck = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs outputs;}; modules = [ ./nixos/deck.nix @@ -70,7 +70,7 @@ }; }; - # Standalone home-manager configuration entrypoint + # Standalone home-manager configuration # Available through 'home-manager --flake .#your-username@your-hostname' homeConfigurations = { "jimbo@JimDesktop" = home-manager.lib.homeManagerConfiguration { @@ -89,7 +89,7 @@ ]; }; "jimbo@JimDeck" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs-unstable.legacyPackages.x86_64-linux; + pkgs = nixpkgs.legacyPackages.x86_64-linux; extraSpecialArgs = {inherit inputs outputs;}; modules = [ ./home-manager/jimbo_deck.nix diff --git a/nixos/base.nix b/nixos/base.nix index 679f70a..aaecff2 100644 --- a/nixos/base.nix +++ b/nixos/base.nix @@ -24,21 +24,6 @@ }; }; - # This will add each flake input as a registry - # To make nix commands consistent with your flake - nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); - - # This will additionally add your inputs to the system's legacy channels - # Making legacy nix commands consistent as well, awesome! - nix.nixPath = ["/etc/nix/path"]; - environment.etc = - lib.mapAttrs' - (name: value: { - name = "nix/path/${name}"; - value.source = value.flake; - }) - config.nix.registry; - # Enable flakes and garbage collection nix = { settings = { @@ -50,8 +35,10 @@ gc = { automatic = true; dates = "weekly"; - options = "--delete-older-than 14d"; + options = "--delete-older-than 1w" }; + # You can also manually optimize the store via nix-store --optimise + settings.auto-optimise-store = true; }; # Set timezone diff --git a/nixos/desktop.nix b/nixos/desktop.nix index 0f5ac9b..c8908db 100644 --- a/nixos/desktop.nix +++ b/nixos/desktop.nix @@ -21,6 +21,7 @@ # Modules ./modules/security.nix + ./modules/legacy.nix # Hardware ./hardware/machines/desktop.nix diff --git a/nixos/modules/legacy.nix b/nixos/modules/legacy.nix new file mode 100644 index 0000000..e66cfa8 --- /dev/null +++ b/nixos/modules/legacy.nix @@ -0,0 +1,16 @@ +{ + # This will add each flake input as a registry + # To make nix commands consistent with your flake + nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nix.nixPath = ["/etc/nix/path"]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; +} diff --git a/nixos/server.nix b/nixos/server.nix index 8ccc8f2..271b807 100644 --- a/nixos/server.nix +++ b/nixos/server.nix @@ -11,6 +11,7 @@ # Modules ./modules/security.nix + ./modules/legacy.nix # Hardware ./hardware/machines/server.nix