Skip to content

Commit

Permalink
Fix some more duplicated nix configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
rake5k committed Jan 4, 2024
1 parent d77cc10 commit fc0e89f
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 70 deletions.
9 changes: 3 additions & 6 deletions home/base/nix-on-droid/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ in
};

config = mkIf cfg.enable {
custom.base = {
nix.enableStoreOptimization = false;
non-nixos = {
enable = true;
installNix = false;
};
custom.base.non-nixos = {
enable = true;
installNix = false;
};
};
}
53 changes: 8 additions & 45 deletions home/base/nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,50 +1,13 @@
{ config, lib, pkgs, inputs, ... }:

with lib;

let

cfg = config.custom.base.nix;

in
{ pkgs, ... }:

{
options = {
custom.base.nix = {
enableStoreOptimization = mkEnableOption "Optimize nix store" // { default = true; };
};
};

config = {
home.packages = [
pkgs.nix-output-monitor
];
home.packages = [
pkgs.nix-output-monitor
];

nix = {
registry = {
nixpkgs.flake = inputs.nixpkgs;
nix-config.flake = inputs.self;
};
settings = {
auto-optimise-store = cfg.enableStoreOptimization;
experimental-features = [ "nix-command" "flakes" ];
log-lines = 30;
substituters = [
"https://christianharke.cachix.org/"
"https://nix-community.cachix.org"
"https://cache.nixos.org"
];
trusted-public-keys = [
"christianharke.cachix.org-1:TzmbiNLRcH8G0932XRlQzh8GPvuV9pJcHLqLnzznLKU="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
};
};
nixpkgs.config = import ./nixpkgs-config.nix;
xdg.configFile."nixpkgs/config.nix".source = ./nixpkgs-config.nix;
nixpkgs.config = import ./nixpkgs-config.nix;
xdg.configFile."nixpkgs/config.nix".source = ./nixpkgs-config.nix;

# Command-not-found replacement
programs.nix-index.enable = true;
};
# Command-not-found replacement
programs.nix-index.enable = true;
}
1 change: 1 addition & 0 deletions lib/builders/mkHome.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ inputs.home-manager.lib.homeManagerConfiguration {
};

modules = [
./modules/nix-commons
"${inputs.self}/hosts/${hostname}/home-${username}.nix"
] ++ homeModules;
}
9 changes: 8 additions & 1 deletion lib/builders/mkNixOnDroid.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,23 @@
inputs.nix-on-droid.lib.nixOnDroidConfiguration {

extraSpecialArgs = {
inherit inputs pkgs homeModules;
inherit homeModules inputs pkgs;
};

modules = [
./modules/nix-nod

# Host config
"${inputs.self}/hosts/${name}"

{
custom.base.hostname = name;

lib.custom = customLib;

nixpkgs = {
inherit pkgs;
};
}
]
++ customLib.getRecursiveDefaultNixFileList ../../nix-on-droid;
Expand Down
22 changes: 22 additions & 0 deletions lib/builders/modules/nix-commons/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ lib, inputs, pkgs, ... }:

let

nixSubstituters = import ../nix-commons/substituters.nix;

in

{
nix = {
package = pkgs.nix;
registry = {
nixpkgs.flake = inputs.nixpkgs;
nix-config.flake = inputs.self;
};
settings = {
auto-optimise-store = lib.mkDefault true;
experimental-features = [ "nix-command" "flakes" ];
log-lines = 30;
} // nixSubstituters;
};
}
12 changes: 12 additions & 0 deletions lib/builders/modules/nix-commons/substituters.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
substituters = [
"https://christianharke.cachix.org/"
"https://nix-community.cachix.org"
"https://cache.nixos.org"
];
trusted-public-keys = [
"christianharke.cachix.org-1:TzmbiNLRcH8G0932XRlQzh8GPvuV9pJcHLqLnzznLKU="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
}
17 changes: 17 additions & 0 deletions lib/builders/modules/nix-nod/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ lib, pkgs, ... }:

let

nixCommons = import ../nix-commons;
nixSubstituters = import ../nix-commons/substituters.nix;

in

lib.recursiveUpdate nixCommons {
nix = {
nixPath = [ "nixpkgs=flake:nixpkgs" ];
settings = {
auto-optimise-store = false;
};
} // nixSubstituters;
}
26 changes: 8 additions & 18 deletions lib/builders/modules/nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
{ pkgs, config, lib, inputs, ... }:
{ lib, pkgs, config, ... } @args:

{
let

nixCommons = import ../nix-commons args;

in

lib.recursiveUpdate nixCommons {
nix = {
nixPath = [ "nixpkgs=flake:nixpkgs" ];
registry = {
nixpkgs.flake = inputs.nixpkgs;
nix-config.flake = inputs.self;
};
settings = {
allowed-users = builtins.attrNames config.users.users;
experimental-features = [ "nix-command" "flakes" ];
log-lines = 30;
substituters = [
"https://christianharke.cachix.org/"
"https://nix-community.cachix.org"
"https://cache.nixos.org"
];
trusted-public-keys = [
"christianharke.cachix.org-1:TzmbiNLRcH8G0932XRlQzh8GPvuV9pJcHLqLnzznLKU="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
};
};

Expand Down

0 comments on commit fc0e89f

Please sign in to comment.