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, pkgs,
lib, lib,
modulesPath, modulesPath,
flake-inputs,
... ...
}: { }: {
imports = [ imports = [
flake-inputs.sops-nix.nixosModules.sops
flake-inputs.tlaternet-webserver.nixosModules.default
"${modulesPath}/profiles/headless.nix" "${modulesPath}/profiles/headless.nix"
"${modulesPath}/profiles/minimal.nix" "${modulesPath}/profiles/minimal.nix"
(import ../modules) (import ../modules)

View file

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

View file

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