mirror of
https://github.com/0xbbjubjub/miniguest.git
synced 2024-08-15 17:00:43 +03:00
refactor nix flake
This commit is contained in:
parent
5957d6a31b
commit
6764080cc7
2
.envrc
2
.envrc
@ -1,2 +1,2 @@
|
|||||||
watch_file devshell.toml
|
|
||||||
use flake || use nix
|
use flake || use nix
|
||||||
|
watch_file flake.nix nix/devshell.*
|
||||||
|
@ -1 +1,2 @@
|
|||||||
(import lib/compat.nix).defaultNix
|
# This file allows nix-build to find the flake
|
||||||
|
(import nix/flake-compat.nix).defaultNix
|
||||||
|
44
flake.lock
44
flake.lock
@ -15,13 +15,29 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1650374568,
|
||||||
|
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1623875721,
|
"lastModified": 1638122382,
|
||||||
"narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
|
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
|
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -30,6 +46,25 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"fup": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1638172912,
|
||||||
|
"narHash": "sha256-jxhQGNEsZTdop/Br3JPS+xmBf6t9cIWRzVZFxbT76Rw=",
|
||||||
|
"owner": "gytis-ivaskevicius",
|
||||||
|
"repo": "flake-utils-plus",
|
||||||
|
"rev": "166d6ebd9f0de03afc98060ac92cba9c71cfe550",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "gytis-ivaskevicius",
|
||||||
|
"ref": "v1.3.1",
|
||||||
|
"repo": "flake-utils-plus",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1624553300,
|
"lastModified": 1624553300,
|
||||||
@ -47,7 +82,8 @@
|
|||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"devshell": "devshell",
|
"devshell": "devshell",
|
||||||
"flake-utils": "flake-utils",
|
"flake-compat": "flake-compat",
|
||||||
|
"fup": "fup",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
58
flake.nix
58
flake.nix
@ -12,33 +12,45 @@
|
|||||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
# The flake file is the entry point for nix commands
|
||||||
{
|
{
|
||||||
description = "guest NixOS images with minimal footprint";
|
description = "guest NixOS images with minimal footprint";
|
||||||
|
|
||||||
|
# Inputs are how Nix can use code from outside the flake during evaluation.
|
||||||
inputs.devshell.url = "github:numtide/devshell";
|
inputs.devshell.url = "github:numtide/devshell";
|
||||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
inputs.fup.url = "github:gytis-ivaskevicius/flake-utils-plus/v1.3.1";
|
||||||
|
inputs.flake-compat.url = "github:edolstra/flake-compat";
|
||||||
|
inputs.flake-compat.flake = false;
|
||||||
|
|
||||||
outputs = inputs@{ self, nixpkgs, devshell, flake-utils }:
|
# Outputs are the public-facing interface to the flake.
|
||||||
with flake-utils.lib;
|
outputs = inputs@{ self, devshell, fup, nixpkgs, ... }: fup.lib.mkFlake {
|
||||||
let
|
|
||||||
overlay = import tool/overlay.nix;
|
inherit self inputs;
|
||||||
in
|
|
||||||
{
|
sharedOverlays = [
|
||||||
nixosModules.core = import ./core;
|
devshell.overlay
|
||||||
nixosModules.declarative = import ./declarative inputs;
|
self.overlay
|
||||||
inherit overlay;
|
];
|
||||||
defaultTemplate = {
|
|
||||||
description = "Example guest configurations";
|
overlay = import tool/overlay.nix;
|
||||||
path = ./template;
|
|
||||||
|
nixosModules.core = import ./core;
|
||||||
|
nixosModules.declarative = import ./declarative inputs;
|
||||||
|
|
||||||
|
defaultTemplate = {
|
||||||
|
description = "Example guest configurations";
|
||||||
|
path = ./template;
|
||||||
|
};
|
||||||
|
|
||||||
|
outputsBuilder = channels: rec {
|
||||||
|
packages = rec {
|
||||||
|
inherit (channels.nixpkgs) miniguest;
|
||||||
|
default = miniguest;
|
||||||
};
|
};
|
||||||
} // eachDefaultSystem (system:
|
defaultPackage = packages.default;
|
||||||
let pkgs = import nixpkgs { inherit system; overlays = [ overlay ]; };
|
defaultApp = fup.lib.mkApp { drv = packages.default; };
|
||||||
in
|
devShell = channels.nixpkgs.callPackage nix/devshell.nix { };
|
||||||
{
|
checks = import ./checks inputs channels.nixpkgs.system;
|
||||||
packages.miniguest = pkgs.miniguest;
|
};
|
||||||
defaultPackage = pkgs.miniguest;
|
};
|
||||||
defaultApp = mkApp { drv = pkgs.miniguest; };
|
|
||||||
devShell = devshell.legacyPackages.${system}.fromTOML ./devshell.toml;
|
|
||||||
checks = import ./checks inputs system;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
3
nix/devshell.nix
Normal file
3
nix/devshell.nix
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{ devshell }:
|
||||||
|
|
||||||
|
devshell.fromTOML ./devshell.toml
|
@ -1,8 +1,9 @@
|
|||||||
let
|
let
|
||||||
rev = "99f1c2157fba4bfe6211a321fd0ee43199025dbf";
|
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
|
||||||
|
inherit (lock.nodes.flake-compat.locked) rev narHash;
|
||||||
flake-compat = fetchTarball {
|
flake-compat = fetchTarball {
|
||||||
url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz";
|
url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz";
|
||||||
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2";
|
sha256 = narHash;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
import flake-compat { src = ./..; }
|
import flake-compat { src = ./..; }
|
Loading…
Reference in New Issue
Block a user