-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
37 lines (31 loc) · 1.11 KB
/
Copy pathflake.nix
File metadata and controls
37 lines (31 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
outputs = { self, nixpkgs }: {
packages = builtins.mapAttrs (system: pkgs: {
hello = pkgs.callPackage ./hello.nix {
version = ''
Hello ${self.rev or self.lastModifiedDate},
nixpkgs ${nixpkgs.rev or nixpkgs.lastModifiedDate}'';
};
}) nixpkgs.legacyPackages;
defaultPackage =
builtins.mapAttrs (_: packages: packages.hello) self.packages;
defaultApp = builtins.mapAttrs (system: package: {
type = "app";
program = "${package}/bin/hello";
}) self.defaultPackage;
checks = builtins.mapAttrs (system: pkgs: {
helloOutputCorrect = pkgs.runCommand "hello-output-correct" { } ''
HELLO_OUTPUT="$(${self.packages.${system}.hello}/bin/hello)"
echo "Hello output is: $HELLO_OUTPUT"
EXPECTED="Hello, world!"
echo "Expected: $EXPECTED"
[[ "$HELLO_OUTPUT" == "$EXPECTED" ]] && touch $out
'';
}) nixpkgs.legacyPackages;
overlays.hello = final: prev: {
hello = final.callPackage ./hello.nix { };
};
overlay = self.overlays.hello;
nixosModules.hello = import ./module.nix;
};
}