diff --git a/configuration/default.nix b/configuration/default.nix index 2a4ce63..d090cef 100644 --- a/configuration/default.nix +++ b/configuration/default.nix @@ -3,13 +3,9 @@ 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) diff --git a/configuration/services/conduit.nix b/configuration/services/conduit.nix index f254c57..ad767db 100644 --- a/configuration/services/conduit.nix +++ b/configuration/services/conduit.nix @@ -2,7 +2,6 @@ pkgs, config, lib, - flake-inputs, ... }: let inherit (lib.strings) concatMapStringsSep; @@ -13,7 +12,6 @@ in { services.matrix-conduit = { enable = true; - package = flake-inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.conduit-matrix; settings.global = { address = "127.0.0.1"; server_name = domain; diff --git a/flake.lock b/flake.lock index 5793ce8..e156a33 100644 --- a/flake.lock +++ b/flake.lock @@ -378,22 +378,6 @@ "type": "github" } }, - "nixpkgs-unstable": { - "locked": { - "lastModified": 1677342105, - "narHash": "sha256-kv1fpkfCJGb0M+LZaCHFUuIS9kRIwyVgupHu86Y28nc=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "b1f87ca164a9684404c8829b851c3586c4d9f089", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_2": { "locked": { "lastModified": 1673345971, @@ -495,7 +479,6 @@ "inputs": { "deploy-rs": "deploy-rs", "nixpkgs": "nixpkgs_2", - "nixpkgs-unstable": "nixpkgs-unstable", "nvfetcher": "nvfetcher", "sops-nix": "sops-nix", "tlaternet-webserver": "tlaternet-webserver" diff --git a/flake.nix b/flake.nix index 3f3865c..2aa6c0b 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,6 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; - nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; deploy-rs.url = "github:serokell/deploy-rs"; sops-nix = { url = "github:Mic92/sops-nix"; @@ -25,8 +24,8 @@ sops-nix, nvfetcher, deploy-rs, - ... - } @ inputs: let + tlaternet-webserver, + }: let system = "x86_64-linux"; in { ################## @@ -34,14 +33,9 @@ ################## nixosConfigurations = { # The actual system definition - tlaternet = nixpkgs.lib.nixosSystem { + tlaternet = self.lib.makeNixosSystem { inherit system; - specialArgs.flake-inputs = inputs; - - modules = [ - ./configuration - ./configuration/hardware-specific/linode - ]; + extraModules = [(import ./configuration/hardware-specific/linode)]; }; }; @@ -69,21 +63,19 @@ #################### # Helper functions # #################### - lib = import ./lib {inherit (nixpkgs) lib;}; + lib = import ./lib { + inherit nixpkgs sops-nix tlaternet-webserver; + lib = nixpkgs.lib; + }; ################### # Utility scripts # ################### packages.${system} = let inherit (nixpkgs.legacyPackages.${system}) writeShellScript; - vm = nixpkgs.lib.nixosSystem { + vm = self.lib.makeNixosSystem { inherit system; - specialArgs.flake-inputs = inputs; - - modules = [ - ./configuration - ./configuration/hardware-specific/vm.nix - ]; + extraModules = [(import ./configuration/hardware-specific/vm.nix)]; }; in { default = vm.config.system.build.vm; diff --git a/lib/default.nix b/lib/default.nix index 20d874d..5f6b68f 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,4 +1,9 @@ -{lib}: let +{ + lib, + nixpkgs, + sops-nix, + tlaternet-webserver, +}: let inherit (lib.attrsets) mapAttrsToList; inherit (lib.strings) concatStringsSep; in { @@ -7,4 +12,19 @@ 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; + }; }