diff options
| author | seth <[email protected]> | 2023-10-31 23:00:00 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-10-31 23:00:00 -0400 |
| commit | d415a8c0481c4d13371f343e1c802bf29135082f (patch) | |
| tree | 7ca07ca91827ffc50ea9694b0b296cc6392d05f0 /modules | |
| parent | fb6e952c39962456160f6ea1e94a5242457703b1 (diff) | |
modules: don't poullute nix path/registry & disable channels on nixos
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/darwin/base.nix | 8 | ||||
| -rw-r--r-- | modules/nixos/base.nix | 25 | ||||
| -rw-r--r-- | modules/shared/nix.nix | 14 |
3 files changed, 18 insertions, 29 deletions
diff --git a/modules/darwin/base.nix b/modules/darwin/base.nix index b01bd12..a6bcc3f 100644 --- a/modules/darwin/base.nix +++ b/modules/darwin/base.nix @@ -1,12 +1,6 @@ -{inputs, ...}: let - channelPath = i: "${inputs.${i}.outPath}"; - mapInputs = fn: map fn (builtins.filter (n: n != "self") (builtins.attrNames inputs)); -in { +{ imports = [../shared]; - nix.nixPath = - mapInputs (i: "${i}=${channelPath i}"); - programs = { bash.enable = true; vim.enable = true; diff --git a/modules/nixos/base.nix b/modules/nixos/base.nix index ca696dd..361829a 100644 --- a/modules/nixos/base.nix +++ b/modules/nixos/base.nix @@ -2,20 +2,9 @@ config, lib, pkgs, - inputs, ... }: let inherit (lib) mkDefault; - channelPath = i: "/etc/nix/channels/${i}"; - - mapInputs = fn: map fn (builtins.filter (n: n != "self") (builtins.attrNames inputs)); - - # yes this is a bad way to detect which option should be used (or exists) - # but i'm lazy. please do not copy this - passwordFile = - if lib.versionAtLeast config.system.stateVersion "23.11" - then "hashedPasswordFile" - else "passwordFile"; in { imports = [ ../shared @@ -42,7 +31,7 @@ in { }; nix = { - nixPath = mapInputs (i: "${i}=${channelPath i}"); + channel.enable = mkDefault false; gc.dates = mkDefault "weekly"; settings.trusted-users = ["root" "@wheel"]; }; @@ -86,14 +75,18 @@ in { ''; }; - systemd.tmpfiles.rules = - mapInputs (i: "L+ ${channelPath i} - - - - ${inputs.${i}.outPath}"); - users = { defaultUserShell = pkgs.bash; mutableUsers = false; - users.root = { + users.root = let + # yes this is a bad way to detect which option should be used (or exists) + # but i'm lazy. please do not copy this + passwordFile = + if lib.versionAtLeast config.system.stateVersion "23.11" + then "hashedPasswordFile" + else "passwordFile"; + in { home = mkDefault "/root"; uid = mkDefault config.ids.uids.root; group = mkDefault "root"; diff --git a/modules/shared/nix.nix b/modules/shared/nix.nix index 2c0aedd..ba95a71 100644 --- a/modules/shared/nix.nix +++ b/modules/shared/nix.nix @@ -5,12 +5,14 @@ ... }: { nix = { - registry = - { - n.flake = lib.mkDefault inputs.nixpkgs; - } - // (builtins.mapAttrs (_: flake: {inherit flake;}) - (lib.filterAttrs (n: _: n != "nixpkgs") inputs)); + registry = { + n.flake = lib.mkDefault inputs.nixpkgs; + self.flake = inputs.self; + }; + + nixPath = [ + "nixpkgs=${inputs.nixpkgs.outPath}" + ]; settings = { auto-optimise-store = pkgs.stdenv.isLinux; |
