diff --git a/modules/base/default.nix b/modules/base/default.nix index ddb45b7..3047db1 100644 --- a/modules/base/default.nix +++ b/modules/base/default.nix @@ -3,6 +3,7 @@ ../options # + ./nix.nix ../home ]; diff --git a/modules/base/nix.nix b/modules/base/nix.nix new file mode 100644 index 0000000..2bf0877 --- /dev/null +++ b/modules/base/nix.nix @@ -0,0 +1,62 @@ +{ + pkgs, + inputs, + ... +}: { + nix = { + package = pkgs.lix; + + # Pin system to flake nixpkgs version. + # i.e. for use in pkgs = import {}. + nixPath = ["nixpkgs=${inputs.nixpkgs}"]; + + # Pin flake registry nixpkgs to flake nixpkgs version. + # i.e. for use in nix search nixpkgs. + registry = { + nixpkgs.flake = inputs.nixpkgs; + }; + + settings = { + experimental-features = ["nix-command" "flakes"]; + + trusted-users = [ + "root" + # @wheel/@admin are added in OS specific modules. + ]; + + # Set up caches. + extra-substituters = [ + "https://marleyos.cachix.org" + "https://nix-community.cachix.org" + ]; + + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "marleyos.cachix.org-1:q2kEtqvS5CoQ8BmKlWOfOnN+fi4gUoSuL6HRKy37eCA=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + + # Disable that annoying "git tree is dirty" warning. + warn-dirty = false; + + auto-optimise-store = true; + + use-xdg-base-directories = true; + }; + + # Garbage collection. + gc.automatic = true; + + # More useful repl. + environment.systemPackages = let + nrepl = + pkgs.writeShellScriptBin "nrepl" + # sh + '' + nix repl "${toString ./.}/repl.nix" "$@" + ''; + in [ + nrepl + ]; + }; +} diff --git a/modules/darwin/base/default.nix b/modules/darwin/base/default.nix new file mode 100644 index 0000000..3925d83 --- /dev/null +++ b/modules/darwin/base/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./nix.nix + ]; +} diff --git a/modules/darwin/base/nix.nix b/modules/darwin/base/nix.nix new file mode 100644 index 0000000..335aa2e --- /dev/null +++ b/modules/darwin/base/nix.nix @@ -0,0 +1,9 @@ +{ + nix = { + settings = { + trusted-users = [ + "@darwin" + ]; + }; + }; +} diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix index 3536ae5..e12f3d1 100644 --- a/modules/darwin/default.nix +++ b/modules/darwin/default.nix @@ -1,5 +1,6 @@ { imports = [ ../base + ./base ]; } diff --git a/modules/nixos/base/nix.nix b/modules/nixos/base/nix.nix index ec7525e..490a284 100644 --- a/modules/nixos/base/nix.nix +++ b/modules/nixos/base/nix.nix @@ -1,12 +1,7 @@ -{pkgs, ...}: { +{ nix = { - package = pkgs.lix; - settings = { - experimental-features = ["nix-command" "flakes"]; - trusted-users = [ - "root" "@wheel" ]; }; diff --git a/snowflake/modules/darwin/base/nix/default.nix b/snowflake/modules/darwin/base/nix/default.nix deleted file mode 100644 index f7cf3bc..0000000 --- a/snowflake/modules/darwin/base/nix/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - pkgs, - ... -}: -{ - config.nix = { - package = pkgs.lix; - }; -} diff --git a/snowflake/modules/home/base/nix/default.nix b/snowflake/modules/home/base/nix/default.nix deleted file mode 100644 index 8cadd7e..0000000 --- a/snowflake/modules/home/base/nix/default.nix +++ /dev/null @@ -1,77 +0,0 @@ -{ - pkgs, - inputs, - config, - lib, - ... -}: { - config = { - nix = { - package = lib.mkForce pkgs.lix; - - # Pin system to flake nixpkgs version. - # i.e. for use in pkgs = import {}. - nixPath = ["nixpkgs=${inputs.nixpkgs}"]; - - # Pin flake registry nixpkgs to flake nixpkgs version. - # i.e. for use in nix search nixpkgs. - registry = { - nixpkgs.flake = inputs.nixpkgs; - }; - - settings = { - trusted-users = [ - "root" - "@wheel" - ]; - - # Enable flakes. - experimental-features = [ - "nix-command" - "flakes" - ]; - - # Set up caches. - extra-substituters = [ - "https://marleyos.cachix.org" - "https://nix-community.cachix.org" - ]; - - trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "marleyos.cachix.org-1:q2kEtqvS5CoQ8BmKlWOfOnN+fi4gUoSuL6HRKy37eCA=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - - # Disable that annoying "git tree is dirty" warning. - warn-dirty = false; - - auto-optimise-store = true; - }; - - # Garbage collection. - gc.automatic = true; - }; - - nixpkgs.config.import = "${config.xdg.configHome}/nixpkgs/config.nix"; - - xdg.configFile."nixpkgs/config.nix".text = - # nix - '' - { - allowUnfree = true; - } - ''; - - home.packages = let - nrepl = - pkgs.writeShellScriptBin "nrepl" - # sh - '' - nix repl "${toString ./.}/repl.nix" "$@" - ''; - in [ - nrepl - ]; - }; -}