From c27b273e17bb42d53fdc5f6fc4234d50fdd07252 Mon Sep 17 00:00:00 2001 From: Dennis <52411861+DerDennisOP@users.noreply.github.com> Date: Fri, 2 Feb 2024 06:12:49 +0100 Subject: [PATCH] fix hydra build packages (#55) * fix hydra build packages * change build input --- flake.lock | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 29 ++++++++++++++++------ 2 files changed, 95 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index 395c185..5086b38 100644 --- a/flake.lock +++ b/flake.lock @@ -53,6 +53,22 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": [ @@ -93,6 +109,22 @@ "type": "github" } }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, "mailserver": { "inputs": { "blobs": "blobs", @@ -124,6 +156,30 @@ "type": "gitlab" } }, + "nix": { + "inputs": { + "flake-compat": "flake-compat_2", + "lowdown-src": "lowdown-src", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1687956155, + "narHash": "sha256-nL3tSXLhXk5jyzX4aWpJvz3JdTyImK+0paRhQqx4f4A=", + "owner": "NixOS", + "repo": "nix", + "rev": "b8cb447a457a4a5e8b26143ba3c8cc5cc6caf0b7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nix", + "type": "github" + } + }, "nix-pre-commit": { "inputs": { "flake-utils": [ @@ -212,12 +268,29 @@ "type": "github" } }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, "root": { "inputs": { "fenix": "fenix", "flake-utils": "flake-utils", "home-manager": "home-manager", "mailserver": "mailserver", + "nix": "nix", "nix-pre-commit": "nix-pre-commit", "nixos-modules": "nixos-modules", "nixpkgs": "nixpkgs", diff --git a/flake.nix b/flake.nix index d3ecedc..ab64e83 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,11 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; systems.url = "github:nix-systems/default"; + nix = { + url = "github:NixOS/nix/nixos-unstable"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + flake-utils = { url = "github:numtide/flake-utils"; inputs.systems.follows = "systems"; @@ -69,12 +74,18 @@ }; }; - outputs = { self, nixpkgs-fmt, home-manager, mailserver, nix-pre-commit, nixos-modules, nixpkgs, sops-nix, ... }: + outputs = { self, nixpkgs-fmt, nix, home-manager, mailserver, nix-pre-commit, nixos-modules, nixpkgs, sops-nix, ... }: let inherit (nixpkgs) lib; systems = [ "x86_64-linux" "aarch64-linux" ]; forEachSystem = lib.genAttrs systems; + overlayList = [ self.overlays.default nix.overlays.default ]; + pkgsBySystem = forEachSystem (system: import nixpkgs { + inherit system; + overlays = overlayList; + }); + src = builtins.filterSource (path: type: type == "directory" || lib.hasSuffix ".nix" (baseNameOf path)) ./.; ls = dir: lib.attrNames (builtins.readDir (src + "/${dir}")); lsdir = dir: if (builtins.pathExists (src + "/${dir}")) then (lib.attrNames (lib.filterAttrs (path: type: type == "directory") (builtins.readDir (src + "/${dir}")))) else [ ]; @@ -129,6 +140,10 @@ in { formatter = forEachSystem (system: nixpkgs-fmt.legacyPackages.${system}.nixpkgs-fmt); + overlays.default = final: prev: { + nixpkgs-fmt = forEachSystem (system: nixpkgs-fmt.legacyPackages.${system}.nixpkgs.fmt); + }; + nixosConfigurations = let constructSystem = { hostname, users, home ? true, modules ? [ ], server ? true, sops ? true, system ? "x86_64-linux" }: @@ -195,16 +210,16 @@ ( (map (machine: { - ${machine.pkgs.system} = (builtins.listToAttrs (map - (pkg: { + ${machine.pkgs.system} = (builtins.listToAttrs (builtins.filter (v: v != { }) (map + (pkg: (if (builtins.hasAttr pkg.name pkgsBySystem.${machine.pkgs.system}) then { name = pkg.name; - value = pkg; - }) - machine.config.environment.systemPackages)); + value = pkgsBySystem.${machine.pkgs.system}.${pkg.name}; + } else { })) + machine.config.environment.systemPackages))); }) (builtins.attrValues self.nixosConfigurations)) ++ [ (forEachSystem (system: { - ${system}.${nixpkgs-fmt.legacyPackages.${system}.nixpkgs-fmt.name} = nixpkgs-fmt.legacyPackages.${system}.nixpkgs-fmt; + ${system}.${nixpkgs-fmt.legacyPackages.${system}.nixpkgs-fmt.name} = pkgsBySystem.${system}.${nixpkgs-fmt.legacyPackages.${system}.nixpkgs-fmt.name}; })) ] ));