mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-30 22:57:55 +00:00
flake.nix: use mkDefault
for default host config
This commit is contained in:
parent
91097f18df
commit
8a9207fba8
22
flake.nix
22
flake.nix
@ -127,7 +127,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# The default configuration for our NixOS systems.
|
# The default configuration for our NixOS systems.
|
||||||
hostDefaultConfig = { pkgs, system, ... }: {
|
hostDefaultConfig = { lib, pkgs, system, ... }: {
|
||||||
# Only use imports as minimally as possible with the absolute
|
# Only use imports as minimally as possible with the absolute
|
||||||
# requirements of a host. On second thought, only on flakes with
|
# requirements of a host. On second thought, only on flakes with
|
||||||
# optional NixOS modules.
|
# optional NixOS modules.
|
||||||
@ -142,23 +142,23 @@
|
|||||||
environment.extraOutputsToInstall = [ "doc" "devdoc" "info" ];
|
environment.extraOutputsToInstall = [ "doc" "devdoc" "info" ];
|
||||||
|
|
||||||
# Bleeding edge, baybee!
|
# Bleeding edge, baybee!
|
||||||
nix.package = pkgs.nixUnstable;
|
nix.package = lib.mkDefault pkgs.nixUnstable;
|
||||||
|
|
||||||
# I want to capture the usual flakes to its exact version so we're
|
# I want to capture the usual flakes to its exact version so we're
|
||||||
# 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'
|
lib.mapAttrs'
|
||||||
(name: flake:
|
(name: flake:
|
||||||
let
|
let
|
||||||
name' = if (name == "self") then "config" else name;
|
name' = if (name == "self") then "config" else name;
|
||||||
in
|
in
|
||||||
lib'.nameValuePair name' { inherit flake; })
|
lib.nameValuePair name' { inherit flake; })
|
||||||
inputs;
|
inputs;
|
||||||
|
|
||||||
# Set several paths for the traditional channels.
|
# Set several paths for the traditional channels.
|
||||||
nix.nixPath =
|
nix.nixPath =
|
||||||
lib'.mapAttrsToList
|
lib.mapAttrsToList
|
||||||
(name: source:
|
(name: source:
|
||||||
let
|
let
|
||||||
name' = if (name == "self") then "config" else name;
|
name' = if (name == "self") then "config" else name;
|
||||||
@ -188,14 +188,14 @@
|
|||||||
# Since we're using flakes to make this possible, we need it. Plus, the
|
# 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.
|
# UX of Nix CLI is becoming closer to Guix's which is a nice bonus.
|
||||||
experimental-features = [ "nix-command" "flakes" ];
|
experimental-features = [ "nix-command" "flakes" ];
|
||||||
auto-optimise-store = true;
|
auto-optimise-store = lib.mkDefault true;
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.config.permittedInsecurePackages =
|
nixpkgs.config.permittedInsecurePackages =
|
||||||
[ "python3.10-django-3.1.14" ];
|
[ "python3.10-django-3.1.14" ];
|
||||||
|
|
||||||
# Stallman-senpai will be disappointed.
|
# Stallman-senpai will be disappointed.
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = lib.mkDefault true;
|
||||||
|
|
||||||
# Extend nixpkgs with our overlays except for the NixOS-focused modules
|
# Extend nixpkgs with our overlays except for the NixOS-focused modules
|
||||||
# here.
|
# here.
|
||||||
@ -207,13 +207,13 @@
|
|||||||
|
|
||||||
# We live in a Unicode world and dominantly English in technical fields so we'll
|
# We live in a Unicode world and dominantly English in technical fields so we'll
|
||||||
# have to go with it.
|
# have to go with it.
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
i18n.defaultLocale = lib.mkDefault "en_US.UTF-8";
|
||||||
|
|
||||||
# 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;
|
||||||
home-manager.sharedModules =
|
home-manager.sharedModules =
|
||||||
lib'.modulesToList (lib'.filesToAttr ./modules/home-manager)
|
lib.modulesToList (lib.filesToAttr ./modules/home-manager)
|
||||||
++ [ userDefaultConfig ];
|
++ [ userDefaultConfig ];
|
||||||
home-manager.extraSpecialArgs = extraArgs;
|
home-manager.extraSpecialArgs = extraArgs;
|
||||||
|
|
||||||
@ -280,7 +280,9 @@
|
|||||||
(host: path:
|
(host: path:
|
||||||
let
|
let
|
||||||
extraModules = [
|
extraModules = [
|
||||||
{ networking.hostName = builtins.baseNameOf path; }
|
({ lib, ... }: {
|
||||||
|
networking.hostName = lib.mkDefault (builtins.baseNameOf path);
|
||||||
|
})
|
||||||
hostDefaultConfig
|
hostDefaultConfig
|
||||||
path
|
path
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user