ref: non-flake compatibility

since this is purely a legacy concern (both default.nix and shell.nix),
we avoid to include the flake-compat as a flake input.

(even though unused inputs are lazily fetched - for style & clarity)
This commit is contained in:
David Arnold 2021-05-28 15:07:11 -05:00
parent ded0db9e3f
commit ee9b4adfc8
No known key found for this signature in database
GPG key ID: 6D6A936E69C59D08
7 changed files with 36 additions and 70 deletions

8
default.nix Normal file
View file

@ -0,0 +1,8 @@
{ system ? builtins.currentSystem }:
let
in (
(import ./lib/compat.nix).flake-compat {
src = ./.;
inherit system;
}
).defaultNix

View file

@ -1,4 +1,4 @@
{ kubenix ? import ./.. { } }:
{ kubenix ? (import ./.. { }).default }:
{
nginx-deployment = import ./nginx-deployment { inherit kubenix; };

35
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": {
"devshell-flake": {
"locked": {
"lastModified": 1620641550,
"narHash": "sha256-o359KdI/LNiPL6EbirONff2MOvZHtZr9MgYx3R9oVFk=",
"lastModified": 1622013274,
"narHash": "sha256-mK/Lv0lCbl07dI5s7tR/7nb79HunKnJik3KyR6yeI2k=",
"owner": "numtide",
"repo": "devshell",
"rev": "a47493423092f6c4c0a7eb605a7cd515a77db4a8",
"rev": "e7faf69e6bf8546517cc936c7f6d31c7eb3abcb2",
"type": "github"
},
"original": {
@ -15,29 +15,13 @@
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1606424373,
"narHash": "sha256-oq8d4//CJOrVj+EcOaSXvMebvuTkmBJuT5tzlfewUnQ=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "99f1c2157fba4bfe6211a321fd0ee43199025dbf",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1605370193,
"narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=",
"lastModified": 1620759905,
"narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5021eac20303a61fafe17224c087f5519baed54d",
"rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8",
"type": "github"
},
"original": {
@ -48,11 +32,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1609233094,
"narHash": "sha256-Ltzng3h4LDNjYAvmoX0kQ3023TvdupwuMvm1D7hZkyY=",
"lastModified": 1622230509,
"narHash": "sha256-ybr8ufMIE1OVIG+S7cMihx1HlrJgTV3lLr/oW/LplTM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2b556ea6712cd4fa76a433093df0cb375a267e3d",
"rev": "190d0579fbb13e83756dc2e6df49a3b9221fbfa9",
"type": "github"
},
"original": {
@ -64,7 +48,6 @@
"root": {
"inputs": {
"devshell-flake": "devshell-flake",
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}

View file

@ -5,12 +5,9 @@
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
devshell-flake.url = "github:numtide/devshell";
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
};
outputs = { self, nixpkgs, flake-utils, devshell-flake, flake-compat }:
{ modules = import ./modules; }
//
outputs = { self, nixpkgs, flake-utils, devshell-flake }:
(flake-utils.lib.eachDefaultSystem
(system:
let
@ -27,29 +24,23 @@
in
rec {
devShell = with pkgs; devshell.mkShell
{
imports = [
(devshell.importTOML ./devshell.toml)
];
};
{ imports = [ (devshell.importTOML ./devshell.toml) ]; };
packages = flake-utils.lib.flattenTree {
inherit (pkgs)
kubenix
kubernetes
kubectl
;
};
hydraJobs = {
inherit packages;
};
defaultPackage = pkgs.kubenix;
}
)
) //
{
modules = import ./src/modules;
overlay = final: prev: {
kubenix = prev.callPackage ./kubenix.nix { };
kubenix = prev.callPackage ./src/kubenix.nix { };
# up to date versions of their nixpkgs equivalents
kubernetes = prev.callPackage ./pkgs/applications/networking/cluster/kubernetes
{ };

View file

@ -1,17 +1,6 @@
let
inherit (builtins)
fetchTarball
fromJSON
readFile
;
lockfile = fromJSON (readFile ../flake.lock);
in
input:
let
locked = lockfile.nodes."${input}".locked;
inherit (locked) rev narHash owner repo;
in
fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
sha256 = narHash;
{
flake-compat = import (builtins.fetchurl {
url = "https://raw.githubusercontent.com/edolstra/flake-compat/99f1c2157fba4bfe6211a321fd0ee43199025dbf/default.nix";
sha256 = "1vas5z58901gavy5d53n1ima482yvly405jp9l8g07nr4abmzsyb";
});
}

View file

@ -1,13 +1,8 @@
(import
(
{ system ? builtins.currentSystem }:
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{
in (
(import ./lib/compat.nix).flake-compat {
src = ./.;
}).shellNix
inherit system;
}
).shellNix

View file

@ -1,6 +1,6 @@
{ pkgs ? import <nixpkgs> { }
, lib ? pkgs.lib
, kubenix ? import ../. { inherit pkgs lib; }
, kubenix ? (import ../. { }).default
, nixosPath ? toString <nixpkgs/nixos>