flake.nix: update the registry and Nix config

This commit is contained in:
Gabriel Arazas 2022-08-10 12:24:09 +08:00
parent 4e996a58cf
commit 9c79c70d3b

View File

@ -141,27 +141,30 @@
# making them available to our system. This will also prevent the # making them available to our system. This will also prevent the
# annoying downloads since it always get the latest revision. # annoying downloads since it always get the latest revision.
nix.registry = nix.registry =
(lib'.mapAttrs' (name: flake: lib'.mapAttrs'
lib'.nameValuePair name { inherit flake; }) (name: flake:
inputs) let
// { name' = if (name == "self") then "config" else name;
# I'm narcissistic so I want my config to be one of the flakes in the in
# registry. lib'.nameValuePair name' { inherit flake; })
config.flake = self; inputs;
};
# Set several paths for the traditional channels. # Set several paths for the traditional channels.
nix.nixPath = nix.nixPath =
lib'.mapAttrsToList (name: source: "${name}=${source}") inputs lib'.mapAttrsToList
(name: source:
let
name' = if (name == "self") then "config" else name;
in
"${name'}=${source}")
inputs
++ [ ++ [
"config=${self}"
"/nix/var/nix/profiles/per-user/root/channels" "/nix/var/nix/profiles/per-user/root/channels"
]; ];
# Set several binary caches.
nix.settings = { nix.settings = {
# Set several binary caches.
substituters = [ substituters = [
"https://cache.nixos.org"
"https://nix-community.cachix.org" "https://nix-community.cachix.org"
"https://foo-dogsquared.cachix.org" "https://foo-dogsquared.cachix.org"
"https://helix.cachix.org" "https://helix.cachix.org"
@ -171,6 +174,14 @@
"foo-dogsquared.cachix.org-1:/2fmqn/gLGvCs5EDeQmqwtus02TUmGy0ZlAEXqRE70E=" "foo-dogsquared.cachix.org-1:/2fmqn/gLGvCs5EDeQmqwtus02TUmGy0ZlAEXqRE70E="
"helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs=" "helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs="
]; ];
# Sane config for the package manager.
# TODO: Remove this after nix-command and flakes has been considered stable.
#
# Since we're using flakes to make this possible, we need it. Plus, the
# UX of Nix CLI is becoming closer to Guix's which is a nice bonus.
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
}; };
nixpkgs.config.permittedInsecurePackages = nixpkgs.config.permittedInsecurePackages =
@ -191,15 +202,6 @@
# have to go with it. # have to go with it.
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
# Sane config for the package manager.
# TODO: Remove this after nix-command and flakes has been considered stable.
#
# Since we're using flakes to make this possible, we need it. Plus, the
# UX of Nix CLI is becoming closer to Guix's which is a nice bonus.
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
# The global configuration for the home-manager module. # The global configuration for the home-manager module.
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
@ -238,18 +240,20 @@
# Hardcoding this is not really great especially if you consider using # Hardcoding this is not really great especially if you consider using
# other locales but its default values are already hardcoded so what # other locales but its default values are already hardcoded so what
# the hell. For other users, they would have to do set these manually. # the hell. For other users, they would have to do set these manually.
xdg.userDirs = let xdg.userDirs =
appendToHomeDir = path: "${config.home.homeDirectory}/${path}"; let
in { appendToHomeDir = path: "${config.home.homeDirectory}/${path}";
desktop = appendToHomeDir "Desktop"; in
documents = appendToHomeDir "Documents"; {
download = appendToHomeDir "Downloads"; desktop = appendToHomeDir "Desktop";
music = appendToHomeDir "Music"; documents = appendToHomeDir "Documents";
pictures = appendToHomeDir "Pictures"; download = appendToHomeDir "Downloads";
publicShare = appendToHomeDir "Public"; music = appendToHomeDir "Music";
templates = appendToHomeDir "Templates"; pictures = appendToHomeDir "Pictures";
videos = appendToHomeDir "Videos"; publicShare = appendToHomeDir "Public";
}; templates = appendToHomeDir "Templates";
videos = appendToHomeDir "Videos";
};
manual = { manual = {
html.enable = true; html.enable = true;