This commit is contained in:
GTrunSec 2022-04-02 13:18:09 -07:00
parent 60592d3096
commit 2f2a3be87d
No known key found for this signature in database
GPG key ID: 2368FAFA4ABDD2A0
4 changed files with 72 additions and 37 deletions

8
.envrc
View file

@ -1,2 +1,6 @@
watch_file devshell.toml flake.nix watch_file flake.nix flake.lock \
use flake || use nix modules/*
{
mkdir -p "$(direnv_layout_dir)"
eval "$(nix print-dev-env --no-update-lock-file --no-write-lock-file --profile $(direnv_layout_dir)/flake-profile)"
} || use nix

62
flake.lock generated
View file

@ -1,12 +1,16 @@
{ {
"nodes": { "nodes": {
"devshell-flake": { "devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": { "locked": {
"lastModified": 1622013274, "lastModified": 1647857022,
"narHash": "sha256-mK/Lv0lCbl07dI5s7tR/7nb79HunKnJik3KyR6yeI2k=", "narHash": "sha256-Aw70NWLOIwKhT60MHDGjgWis3DP3faCzr6ap9CSayek=",
"owner": "numtide", "owner": "numtide",
"repo": "devshell", "repo": "devshell",
"rev": "e7faf69e6bf8546517cc936c7f6d31c7eb3abcb2", "rev": "0a5ff74dacb9ea22614f64e61aeb3ca0bf0e7311",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -17,11 +21,26 @@
}, },
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1620759905, "lastModified": 1642700792,
"narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=", "narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8", "rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1648297722,
"narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -32,24 +51,41 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1622230509, "lastModified": 1643381941,
"narHash": "sha256-ybr8ufMIE1OVIG+S7cMihx1HlrJgTV3lLr/oW/LplTM=", "narHash": "sha256-pHTwvnN4tTsEKkWlXQ8JMY423epos8wUOhthpwJjtpc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "190d0579fbb13e83756dc2e6df49a3b9221fbfa9", "rev": "5efc8ca954272c4376ac929f4c5ffefcc20551d5",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1648219316,
"narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "30d3d79b7d3607d56546dd2a6b49e156ba0ec634",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"devshell-flake": "devshell-flake", "devshell": "devshell",
"flake-utils": "flake-utils", "flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs_2"
} }
} }
}, },

View file

@ -3,33 +3,28 @@
inputs = { inputs = {
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
devshell-flake.url = "github:numtide/devshell"; devshell.url = "github:numtide/devshell";
}; };
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
flake-utils, ...
devshell-flake, } @ inputs:
}: (inputs.flake-utils.lib.eachDefaultSystem (
(flake-utils.lib.eachDefaultSystem (
system: let system: let
pkgs = import nixpkgs { pkgs = inputs.nixpkgs.legacyPackages."${system}".appendOverlays [
inherit system;
overlays = [
self.overlay self.overlay
devshell-flake.overlay inputs.devshell.overlay
]; ];
config = {allowUnsupportedSystem = true;};
};
lib = pkgs.lib; lib = pkgs.lib;
kubenix = { kubenix = {
lib = import ./lib {inherit lib pkgs;}; lib = import ./lib {inherit lib pkgs;};
evalModules = self.evalModules.${system}; evalModules = self.evalModules.${system};
modules = self.modules; modules = self.nixosModules.kubenix;
}; };
# evalModules with same interface as lib.evalModules and kubenix as # evalModules with same interface as lib.evalModules and kubenix as
@ -61,7 +56,7 @@
devshell.mkShell devshell.mkShell
{imports = [(devshell.importTOML ./devshell.toml)];}; {imports = [(devshell.importTOML ./devshell.toml)];};
packages = flake-utils.lib.flattenTree { packages = inputs.flake-utils.lib.flattenTree {
inherit (pkgs) kubernetes kubectl; inherit (pkgs) kubernetes kubectl;
}; };
@ -86,14 +81,14 @@
} }
)) ))
// { // {
modules = import ./modules; nixosModules.kubenix = import ./modules;
overlay = final: prev: { overlay = final: prev: {
kubenix.evalModules = self.evalModules.${prev.system}; kubenix.evalModules = self.evalModules.${prev.system};
# up to date versions of their nixpkgs equivalents # up to date versions of their nixpkgs equivalents
kubernetes = # kubernetes =
prev.callPackage ./pkgs/applications/networking/cluster/kubernetes # prev.callPackage ./pkgs/applications/networking/cluster/kubernetes
{}; # {};
kubectl = prev.callPackage ./pkgs/applications/networking/cluster/kubectl {}; # kubectl = prev.callPackage ./pkgs/applications/networking/cluster/kubectl {};
}; };
}; };
} }

View file

@ -40,7 +40,7 @@ let
in "${prefix}_${t.name}_test.py"; in "${prefix}_${t.name}_test.py";
}); });
in pkgs.linkFarm "${testing.name}-tests" ( in pkgs.linkFarm "${testing.name}-tests" (
lib.imap0 op allEligibleTests; lib.imap0 op allEligibleTests
); );
testScript = pkgs.writeScript "test-${testing.name}.sh" '' testScript = pkgs.writeScript "test-${testing.name}.sh" ''