Merge pull request #287 from nix-community/nixos-facter
package nixos-facter for stable as well
This commit is contained in:
commit
3e7978bab1
3 changed files with 79 additions and 3 deletions
|
@ -34,7 +34,9 @@
|
||||||
# for copying extra files of nixos-anywhere
|
# for copying extra files of nixos-anywhere
|
||||||
pkgs.rsync
|
pkgs.rsync
|
||||||
# alternative to nixos-generate-config
|
# alternative to nixos-generate-config
|
||||||
] ++ lib.optional (pkgs ? nixos-facter) pkgs.nixos-facter;
|
# TODO: use nixpkgs again after next nixos release
|
||||||
|
(pkgs.callPackage ./nixos-facter.nix {})
|
||||||
|
];
|
||||||
|
|
||||||
# Don't add nixpkgs to the image to save space, for our intended use case we don't need it
|
# Don't add nixpkgs to the image to save space, for our intended use case we don't need it
|
||||||
system.installer.channel.enable = false;
|
system.installer.channel.enable = false;
|
||||||
|
|
|
@ -11,9 +11,8 @@ pkgs.testers.runNixOSTest {
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
node1 = { modulesPath, ... }: {
|
node1 = { modulesPath, pkgs, ... }: {
|
||||||
virtualisation.vlans = [ ];
|
virtualisation.vlans = [ ];
|
||||||
environment.noXlibs = false; # avoid recompilation
|
|
||||||
imports = [
|
imports = [
|
||||||
(modulesPath + "/profiles/minimal.nix")
|
(modulesPath + "/profiles/minimal.nix")
|
||||||
];
|
];
|
||||||
|
@ -66,6 +65,9 @@ pkgs.testers.runNixOSTest {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
} // lib.optionalAttrs (lib.versionOlder lib.version "24.11pre") {
|
||||||
|
# avoid second overlay
|
||||||
|
environment.noXlibs = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
72
nix/nixos-facter.nix
Normal file
72
nix/nixos-facter.nix
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
buildGoModule,
|
||||||
|
fetchFromGitHub,
|
||||||
|
hwinfo,
|
||||||
|
libusb1,
|
||||||
|
gcc,
|
||||||
|
pkg-config,
|
||||||
|
util-linux,
|
||||||
|
pciutils,
|
||||||
|
stdenv,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
# We are waiting on some changes to be merged upstream: https://github.com/openSUSE/hwinfo/pulls
|
||||||
|
hwinfoOverride = hwinfo.overrideAttrs {
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "numtide";
|
||||||
|
repo = "hwinfo";
|
||||||
|
rev = "a559f34934098d54096ed2078e750a8245ae4044";
|
||||||
|
hash = "sha256-3abkWPr98qXXQ17r1Z43gh2M5hl/DHjW2hfeWl+GSAs=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
buildGoModule rec {
|
||||||
|
pname = "nixos-facter";
|
||||||
|
version = "0.1.0pre";
|
||||||
|
|
||||||
|
# https://github.com/numtide/nixos-facter/pull/120
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "numtide";
|
||||||
|
repo = "nixos-facter";
|
||||||
|
rev = "f16b36d8d4c80db4b8bc96be090749bbeeb66364";
|
||||||
|
hash = "sha256-5Gnn2ta/xuht6K8M9weVC0yPw5Wq8AK6wAHmjd1m2i0=";
|
||||||
|
};
|
||||||
|
|
||||||
|
vendorHash = "sha256-5leiTNp3FJmgFd0SKhu18hxYZ2G9SuQPhZJjki2SDVs=";
|
||||||
|
|
||||||
|
CGO_ENABLED = 1;
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
libusb1
|
||||||
|
hwinfoOverride
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
gcc
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
|
||||||
|
runtimeInputs = [
|
||||||
|
libusb1
|
||||||
|
util-linux
|
||||||
|
pciutils
|
||||||
|
];
|
||||||
|
|
||||||
|
ldflags = [
|
||||||
|
"-s"
|
||||||
|
"-w"
|
||||||
|
"-X git.numtide.com/numtide/nixos-facter/build.Name=nixos-facter"
|
||||||
|
"-X git.numtide.com/numtide/nixos-facter/build.Version=v${version}"
|
||||||
|
"-X github.com/numtide/nixos-facter/pkg/build.System=${stdenv.hostPlatform.system}"
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Declarative hardware configuration for NixOS";
|
||||||
|
homepage = "https://github.com/numtide/nixos-facter";
|
||||||
|
license = lib.licenses.gpl3Plus;
|
||||||
|
maintainers = [ lib.maintainers.brianmcgee ];
|
||||||
|
mainProgram = "nixos-facter";
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue