mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-12 06:19:00 +00:00
lib/flake-utils: refactor mkHost
Now that `system` top-level attribute in `configuration.nix` is documented and comes with additional options now, we'll have to move the system configuration into a new namespace. This is just the easy way out.
This commit is contained in:
parent
7ae53c1563
commit
99050bc806
108
flake.nix
108
flake.nix
@ -100,63 +100,63 @@
|
|||||||
lib = nixpkgs.lib.extend (final: prev: import ./lib { lib = prev; });
|
lib = nixpkgs.lib.extend (final: prev: import ./lib { lib = prev; });
|
||||||
};
|
};
|
||||||
|
|
||||||
# The default configuration for a NixOS system STARTS HERE.
|
config = {
|
||||||
|
# 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
|
||||||
|
# annoying downloads since it always get the latest revision.
|
||||||
|
nix.registry = {
|
||||||
|
# I'm narcissistic so I want my config to be one of the flakes in the registry.
|
||||||
|
config.flake = self;
|
||||||
|
|
||||||
# I want to capture the usual flakes to its exact version so we're
|
# All of the important flakes will be included.
|
||||||
# making them available to our system. This will also prevent the
|
nixpkgs.flake = nixpkgs;
|
||||||
# annoying downloads since it always get the latest revision.
|
home-manager.flake = inputs.home-manager;
|
||||||
nix.registry = {
|
agenix.flake = inputs.agenix;
|
||||||
# I'm narcissistic so I want my config to be one of the flakes in the registry.
|
nur.flake = inputs.nur;
|
||||||
config.flake = self;
|
guix-overlay.flake = inputs.guix-overlay;
|
||||||
|
nixos-generators.flake = inputs.nixos-generators;
|
||||||
|
};
|
||||||
|
|
||||||
# All of the important flakes will be included.
|
# We may as well live on the BLEEDING EDGE!
|
||||||
nixpkgs.flake = nixpkgs;
|
nix.package = nixpkgs.legacyPackages.${system}.nixUnstable;
|
||||||
home-manager.flake = inputs.home-manager;
|
|
||||||
agenix.flake = inputs.agenix;
|
# Set several binary caches.
|
||||||
nur.flake = inputs.nur;
|
nix.settings = {
|
||||||
guix-overlay.flake = inputs.guix-overlay;
|
substituters = [
|
||||||
nixos-generators.flake = inputs.nixos-generators;
|
"https://cache.nixos.org"
|
||||||
|
"https://nix-community.cachix.org"
|
||||||
|
"https://foo-dogsquared.cachix.org"
|
||||||
|
];
|
||||||
|
trusted-public-keys = [
|
||||||
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||||
|
"foo-dogsquared.cachix.org-1:/2fmqn/gLGvCs5EDeQmqwtus02TUmGy0ZlAEXqRE70E="
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Stallman-senpai will be disappointed.
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
# Extend nixpkgs with our overlays except for the NixOS-focused modules
|
||||||
|
# here.
|
||||||
|
nixpkgs.overlays = overlays
|
||||||
|
++ [ inputs.nix-alien.overlay inputs.guix-overlay.overlays.default ];
|
||||||
|
|
||||||
|
# Please clean your temporary crap.
|
||||||
|
boot.cleanTmpDir = true;
|
||||||
|
|
||||||
|
# We live in a Unicode world and dominantly English in technical fields so we'll
|
||||||
|
# have to go with it.
|
||||||
|
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
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
# We may as well live on the BLEEDING EDGE!
|
|
||||||
nix.package = nixpkgs.legacyPackages.${system}.nixUnstable;
|
|
||||||
|
|
||||||
# Set several binary caches.
|
|
||||||
nix.settings = {
|
|
||||||
substituters = [
|
|
||||||
"https://cache.nixos.org"
|
|
||||||
"https://nix-community.cachix.org"
|
|
||||||
"https://foo-dogsquared.cachix.org"
|
|
||||||
];
|
|
||||||
trusted-public-keys = [
|
|
||||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
||||||
"foo-dogsquared.cachix.org-1:/2fmqn/gLGvCs5EDeQmqwtus02TUmGy0ZlAEXqRE70E="
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Stallman-senpai will be disappointed.
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
|
||||||
|
|
||||||
# Extend nixpkgs with our overlays except for the NixOS-focused modules
|
|
||||||
# here.
|
|
||||||
nixpkgs.overlays = overlays
|
|
||||||
++ [ inputs.nix-alien.overlay inputs.guix-overlay.overlays.default ];
|
|
||||||
|
|
||||||
# Please clean your temporary crap.
|
|
||||||
boot.cleanTmpDir = true;
|
|
||||||
|
|
||||||
# We live in a Unicode world and dominantly English in technical fields so we'll
|
|
||||||
# have to go with it.
|
|
||||||
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 default config for our home-manager configurations.
|
# The default config for our home-manager configurations.
|
||||||
|
@ -26,7 +26,7 @@ in rec {
|
|||||||
=> { ... } # NixOS configuration attrset
|
=> { ... } # NixOS configuration attrset
|
||||||
*/
|
*/
|
||||||
mkHost = file:
|
mkHost = file:
|
||||||
attrs@{ system ? sys, specialArgs ? { inherit lib system inputs; }, ... }:
|
{ system ? sys, specialArgs ? { inherit lib system inputs; }, config ? { } }:
|
||||||
(lib.makeOverridable inputs.nixpkgs.lib.nixosSystem) {
|
(lib.makeOverridable inputs.nixpkgs.lib.nixosSystem) {
|
||||||
# The system of the NixOS system.
|
# The system of the NixOS system.
|
||||||
inherit system specialArgs;
|
inherit system specialArgs;
|
||||||
@ -40,7 +40,7 @@ in rec {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Put the given attribute set (except for the system).
|
# Put the given attribute set (except for the system).
|
||||||
(lib.filterAttrs (n: v: !lib.elem n [ "system" "specialArgs" ]) attrs)
|
config
|
||||||
|
|
||||||
# The entry point of the module.
|
# The entry point of the module.
|
||||||
file
|
file
|
||||||
|
Loading…
Reference in New Issue
Block a user