refactoring: Use flake-inputs instead of awkwardly passing through

This commit is contained in:
Tristan Daniël Maat 2023-02-26 05:44:54 +00:00
parent b7feffc52f
commit bb397841ee
Signed by: tlater
GPG key ID: 49670FD774E43268
3 changed files with 22 additions and 31 deletions

View file

@ -3,9 +3,13 @@
pkgs,
lib,
modulesPath,
flake-inputs,
...
}: {
imports = [
flake-inputs.sops-nix.nixosModules.sops
flake-inputs.tlaternet-webserver.nixosModules.default
"${modulesPath}/profiles/headless.nix"
"${modulesPath}/profiles/minimal.nix"
(import ../modules)

View file

@ -24,8 +24,8 @@
sops-nix,
nvfetcher,
deploy-rs,
tlaternet-webserver,
}: let
...
} @ inputs: let
system = "x86_64-linux";
in {
##################
@ -33,9 +33,14 @@
##################
nixosConfigurations = {
# The actual system definition
tlaternet = self.lib.makeNixosSystem {
tlaternet = nixpkgs.lib.nixosSystem {
inherit system;
extraModules = [(import ./configuration/hardware-specific/linode)];
specialArgs.flake-inputs = inputs;
modules = [
./configuration
./configuration/hardware-specific/linode
];
};
};
@ -63,19 +68,21 @@
####################
# Helper functions #
####################
lib = import ./lib {
inherit nixpkgs sops-nix tlaternet-webserver;
lib = nixpkgs.lib;
};
lib = import ./lib {inherit (nixpkgs) lib;};
###################
# Utility scripts #
###################
packages.${system} = let
inherit (nixpkgs.legacyPackages.${system}) writeShellScript;
vm = self.lib.makeNixosSystem {
vm = nixpkgs.lib.nixosSystem {
inherit system;
extraModules = [(import ./configuration/hardware-specific/vm.nix)];
specialArgs.flake-inputs = inputs;
modules = [
./configuration
./configuration/hardware-specific/vm.nix
];
};
in {
default = vm.config.system.build.vm;

View file

@ -1,9 +1,4 @@
{
lib,
nixpkgs,
sops-nix,
tlaternet-webserver,
}: let
{lib}: let
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.strings) concatStringsSep;
in {
@ -12,19 +7,4 @@ in {
(mapAttrsToList
(host: vm: "hostfwd=::${host}-:${vm}")
portMapping);
makeNixosSystem = {
system,
extraModules,
}:
nixpkgs.lib.nixosSystem {
inherit system;
modules =
[
sops-nix.nixosModules.sops
tlaternet-webserver.nixosModules.default
(import ../configuration)
]
++ extraModules;
};
}