chore: update nix files (#360)

* ci: ignore nix files

* chore: add nix flake
This commit is contained in:
Abiola Ibrahim
2022-07-01 07:02:20 +01:00
committed by GitHub
parent 2864461354
commit 8bb1101a86
7 changed files with 110 additions and 26 deletions
+6 -2
View File
@@ -4,11 +4,15 @@ on:
push:
tags: ["v*"]
paths-ignore:
- '**/*.md'
- "**/*.md"
- "**/*.nix"
- "**/*.lock"
pull_request:
branches: [main]
paths-ignore:
- '**/*.md'
- "**/*.md"
- "**/*.nix"
- "**/*.lock"
jobs:
build:
+6 -2
View File
@@ -4,10 +4,14 @@ on:
tags: [v*]
branches: [main]
paths-ignore:
- '**/*.md'
- "**/*.md"
- "**/*.nix"
- "**/*.lock"
pull_request:
paths-ignore:
- '**/*.md'
- "**/*.md"
- "**/*.nix"
- "**/*.lock"
jobs:
golangci:
name: lint
+6 -2
View File
@@ -5,11 +5,15 @@ on:
tags: ["v*"]
branches: [main]
paths-ignore:
- '**/*.md'
- "**/*.md"
- "**/*.nix"
- "**/*.lock"
pull_request:
branches: [main]
paths-ignore:
- '**/*.md'
- "**/*.md"
- "**/*.nix"
- "**/*.lock"
jobs:
kubernetes-docker:
runs-on: macos-11
+29
View File
@@ -0,0 +1,29 @@
{ pkgs ? import <nixpkgs> }:
with pkgs;
buildGo118Module {
name = "colima";
pname = "colima";
src = ./.;
nativeBuildInputs = [ installShellFiles makeWrapper git ];
vendorSha256 = "sha256-jDzDwK7qA9lKP8CfkKzfooPDrHuHI4OpiLXmX9vOpOg=";
# `nix-build` has .git folder but `nix build` does not, this caters for both cases
preConfigure = ''
export VERSION="$(git describe --tags --always || echo nix-build-at-"$(date +%s)")"
export REVISION="$(git rev-parse HEAD || echo nix-unknown)"
ldflags="-X github.com/abiosoft/colima/config.appVersion=$VERSION
-X github.com/abiosoft/colima/config.revision=$REVISION"
'';
postInstall = ''
wrapProgram $out/bin/colima \
--prefix PATH : ${lib.makeBinPath [ qemu lima ]}
installShellCompletion --cmd colima \
--bash <($out/bin/colima completion bash) \
--fish <($out/bin/colima completion fish) \
--zsh <($out/bin/colima completion zsh)
'';
}
+1 -20
View File
@@ -1,21 +1,2 @@
with import <nixpkgs> { };
buildGo118Module rec {
name = "colima";
pname = "colima";
src = ./.;
nativeBuildInputs = [ installShellFiles makeWrapper git ];
vendorSha256 = "sha256-jDzDwK7qA9lKP8CfkKzfooPDrHuHI4OpiLXmX9vOpOg=";
preConfigure = ''
ldflags="-X github.com/abiosoft/colima/config.appVersion=$(git describe --tags --always)
-X github.com/abiosoft/colima/config.revision=$(git rev-parse HEAD)"
'';
postInstall = ''
wrapProgram $out/bin/colima \
--prefix PATH : ${lib.makeBinPath [ qemu lima ]}
installShellCompletion --cmd colima \
--bash <($out/bin/colima completion bash) \
--fish <($out/bin/colima completion fish) \
--zsh <($out/bin/colima completion zsh)
'';
}
callPackage (import ./colima.nix) { }
Generated
+42
View File
@@ -0,0 +1,42 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1656065134,
"narHash": "sha256-oc6E6ByIw3oJaIyc67maaFcnjYOz1mMcOtHxbEf9NwQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "bee6a7250dd1b01844a2de7e02e4df7d8a0a206c",
"type": "github"
},
"original": {
"id": "flake-utils",
"type": "indirect"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1656546896,
"narHash": "sha256-WpMqq6OHQinBZjxemh2jthIvUpNoqNwqpYipbZUOsQs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7fb2acd492c96ea4a1a37ec060edb1e1774eeb5b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+20
View File
@@ -0,0 +1,20 @@
{
description = "Container runtimes on macOS (and Linux) with minimal setup";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-22.05";
outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages.default = import ./colima.nix { inherit pkgs; };
devShell = import ./shell.nix { inherit pkgs; };
apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/colima";
};
}
);
}