Use flake-utils, use mkShell
This fixes the devshell on darwin
This commit is contained in:
parent
76cca9c1c0
commit
fad4da3f6b
34
flake.lock
generated
34
flake.lock
generated
@ -1,5 +1,23 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@ -38,9 +56,25 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
87
flake.nix
87
flake.nix
@ -3,57 +3,58 @@
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
gitignore = {
|
||||
url = "github:hercules-ci/gitignore.nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, gitignore }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
outputs = { self, nixpkgs, flake-utils, gitignore }: flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
vrnp-static = pkgs.buildGoModule {
|
||||
pname = "vrnp";
|
||||
version = "0.0.5";
|
||||
vendorHash = null;
|
||||
vrnp-static = pkgs.buildGoModule {
|
||||
pname = "vrnp";
|
||||
version = "0.0.5";
|
||||
vendorHash = null;
|
||||
|
||||
# For building the package, we use only the files not ignored by Git as inputs.
|
||||
# Also, flake.nix and flake.lock are not included to avoid annoying rebuilds when
|
||||
# working on them.
|
||||
src = pkgs.lib.cleanSourceWith {
|
||||
src = gitignore.lib.gitignoreSource ./.;
|
||||
filter = path: type: builtins.baseNameOf path != "flake.nix" && builtins.baseNameOf path != "flake.lock";
|
||||
};
|
||||
|
||||
# Avoid linking against libc
|
||||
CGO_ENABLED = 0;
|
||||
};
|
||||
in {
|
||||
devShell.${system} = pkgs.mkShellNoCC {
|
||||
packages = [
|
||||
pkgs.go
|
||||
(pkgs.python3.withPackages (ps: with ps; [ pillow ]))
|
||||
];
|
||||
};
|
||||
packages.${system} = {
|
||||
default = vrnp-static;
|
||||
image-meta = pkgs.runCommand "vrnp-version" {} ''
|
||||
mkdir -p $out
|
||||
echo -n ${vrnp-static.version} > $out/version
|
||||
echo -n git.pbrinkmeier.de/paul/vrnp:${vrnp-static.version} > $out/name
|
||||
'';
|
||||
image = pkgs.dockerTools.buildImage {
|
||||
name = "git.pbrinkmeier.de/paul/vrnp";
|
||||
tag = vrnp-static.version;
|
||||
copyToRoot = pkgs.buildEnv {
|
||||
name = "vrnp-root";
|
||||
paths = [ vrnp-static pkgs.cacert ];
|
||||
pathsToLink = [ "/bin" "/etc" ];
|
||||
# For building the package, we use only the files not ignored by Git as inputs.
|
||||
# Also, flake.nix and flake.lock are not included to avoid annoying rebuilds when
|
||||
# working on them.
|
||||
src = pkgs.lib.cleanSourceWith {
|
||||
src = gitignore.lib.gitignoreSource ./.;
|
||||
filter = path: type: builtins.baseNameOf path != "flake.nix" && builtins.baseNameOf path != "flake.lock";
|
||||
};
|
||||
config.Cmd = [ "${vrnp-static}/bin/vrnp" ];
|
||||
|
||||
# Avoid linking against libc
|
||||
CGO_ENABLED = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
devShell = pkgs.mkShell {
|
||||
packages = [
|
||||
pkgs.go
|
||||
(pkgs.python3.withPackages (ps: with ps; [ pillow ]))
|
||||
];
|
||||
};
|
||||
packages = {
|
||||
default = vrnp-static;
|
||||
image-meta = pkgs.runCommand "image-meta" {} ''
|
||||
mkdir -p $out
|
||||
echo -n ${vrnp-static.version} > $out/version
|
||||
echo -n git.pbrinkmeier.de/paul/vrnp:${vrnp-static.version} > $out/name
|
||||
'';
|
||||
image = pkgs.dockerTools.buildImage {
|
||||
name = "git.pbrinkmeier.de/paul/vrnp";
|
||||
tag = vrnp-static.version;
|
||||
copyToRoot = pkgs.buildEnv {
|
||||
name = "vrnp-root";
|
||||
paths = [ vrnp-static pkgs.cacert ];
|
||||
pathsToLink = [ "/bin" "/etc" ];
|
||||
};
|
||||
config.Cmd = [ "${vrnp-static}/bin/vrnp" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user