Last active
February 25, 2021 22:30
-
-
Save jkachmar/30685a0a172419e4f9af23249834e3e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################ | |
# Shared `nixpkgs` configuration settings. # | |
############################################ | |
{ | |
allowUnfree = true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################## | |
# OS-agnostic `nixpkgs` configuration. # | |
######################################## | |
{ inputs, lib, pkgs, ... }: | |
let | |
inherit (pkgs.stdenv.targetPlatform) isLinux; | |
in | |
{ | |
nix = { | |
nixPath = lib.mkForce [ | |
"nixpkgs=${inputs.nixpkgs}" | |
"unstable=${inputs.unstable}" | |
]; | |
registry = { | |
nixpkgs.flake = inputs.nixpkgs; | |
unstable.flake = inputs.unstable; | |
}; | |
}; | |
nixpkgs = { | |
config = import ./config.nix; | |
# TODO: Stick construct overlays in `flake.nix` and stick them in the | |
# module args (or something). | |
overlays = [ ]; | |
}; | |
# TODO: Document why both of these settings are being enabled. | |
# | |
# The short answer is that someone recommended it when using home-manager | |
# and Flakes, but this deserves a more rigorous explanation. | |
home-manager = { | |
useGlobalPkgs = true; | |
useUserPackages = true; | |
}; | |
primary-user.home-manager.xdg.configFile."nixpkgs/config.nix".source = ./config.nix; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
inputs = { ... }; # Elided... | |
outputs = inputs@{ self, nixpkgs, unstable, home, impermanence, ... }: | |
let | |
# Utility function to construct a package set based on the given system | |
# along with the shared `nixpkgs` configuration defined in this repo. | |
mkPkgsFor = system: pkgset: | |
import pkgset { | |
inherit system; | |
config = import ./config/modules/system/nixpkgs/config.nix; | |
}; | |
# Utility function to construct a NixOS configuration for arbitrary | |
# systems. | |
# | |
# TODO: Push more of this functionality down down into the | |
# `./config/machines` modules to avoid # cluttering up `flake.nix` any | |
# more than is necessary. | |
mkNixOSConfiguration = hostname: system: nixpkgs.lib.nixosSystem { | |
inherit system; | |
modules = [ | |
nixpkgs.nixosModules.notDetected | |
home.nixosModules.home-manager | |
impermanence.nixosModules.impermanence | |
# XXX: Nix needs an absolute path here; consider constructing this manually. | |
(./. + "/config/machines/${hostname}") | |
]; | |
specialArgs = { | |
inherit inputs; | |
pkgs = mkPkgsFor system nixpkgs; | |
unstable = mkPkgsFor system unstable; | |
}; | |
}; | |
in | |
{ | |
nixosConfigurations = { | |
star-platinum = mkNixOSConfiguration "star-platinum" "x86_64-linux"; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment