Add krops
This commit is contained in:
parent
4d6c4f1657
commit
fbc787fa49
2 changed files with 85 additions and 0 deletions
24
flake.lock
generated
24
flake.lock
generated
|
|
@ -36,6 +36,29 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"krops": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": [
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1644957911,
|
||||||
|
"narHash": "sha256-ggie/j7pdBqzDs4W7OiPmhqH9IGbXAbJxGqBdVxA8jA=",
|
||||||
|
"owner": "Mic92",
|
||||||
|
"repo": "krops",
|
||||||
|
"rev": "86fb3d2ee94fd8306231853b323ed8804edf26ec",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Mic92",
|
||||||
|
"repo": "krops",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nix-pre-commit-hooks": {
|
"nix-pre-commit-hooks": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": [
|
"flake-utils": [
|
||||||
|
|
@ -139,6 +162,7 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
|
"krops": "krops",
|
||||||
"nix-pre-commit-hooks": "nix-pre-commit-hooks",
|
"nix-pre-commit-hooks": "nix-pre-commit-hooks",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"nixpkgsMaster": "nixpkgsMaster",
|
"nixpkgsMaster": "nixpkgsMaster",
|
||||||
|
|
|
||||||
61
flake.nix
61
flake.nix
|
|
@ -20,11 +20,20 @@
|
||||||
url = "github:Mic92/sops-nix";
|
url = "github:Mic92/sops-nix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
krops = {
|
||||||
|
url = "github:Mic92/krops";
|
||||||
|
inputs = {
|
||||||
|
flake-utils.follows = "flake-utils";
|
||||||
|
nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
outputs =
|
outputs =
|
||||||
{ self
|
{ self
|
||||||
, nixpkgs
|
, nixpkgs
|
||||||
, flake-utils
|
, flake-utils
|
||||||
|
, krops
|
||||||
, home-manager
|
, home-manager
|
||||||
, nur
|
, nur
|
||||||
, nix-pre-commit-hooks
|
, nix-pre-commit-hooks
|
||||||
|
|
@ -62,12 +71,48 @@
|
||||||
${self.checks.${system}.pre-commit-check.shellHook}
|
${self.checks.${system}.pre-commit-check.shellHook}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
apps = lib.mapAttrs
|
||||||
|
(name: program: { type = "app"; program = toString program; })
|
||||||
|
(flake-utils.lib.flattenTree {
|
||||||
|
deploy = lib.recurseIntoAttrs (lib.mapAttrs
|
||||||
|
(hostname: machine:
|
||||||
|
let
|
||||||
|
inherit (krops.packages.${system}) writeCommand;
|
||||||
|
inherit (krops) lib;
|
||||||
|
in
|
||||||
|
writeCommand "deploy-${hostname}" {
|
||||||
|
target = lib.mkTarget "root@${machine.config.deployment.targetHost}" // {
|
||||||
|
extraOptions = [
|
||||||
|
# force allocation of tty to allow aborting with ^C and to show build progress
|
||||||
|
"-t"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
source = lib.evalSource (lib.singleton {
|
||||||
|
config.file = {
|
||||||
|
path = toString ./.;
|
||||||
|
useChecksum = true;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
command = targetPath: ''
|
||||||
|
nixos-rebuild switch --flake ${targetPath}/config -L --keep-going
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
)
|
||||||
|
self.nixosConfigurations);
|
||||||
|
|
||||||
|
showKeyFingerprint = pkgs.writeShellScript "show-key-fingerprint" ''
|
||||||
|
${pkgs.gnupg}/bin/gpg --with-fingerprint --with-colons --show-key "keys/''${1}.asc" | awk -F: '$1 == "fpr" { print $10; exit }'
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
}) // {
|
}) // {
|
||||||
overlay = import ./pkgs;
|
overlay = import ./pkgs;
|
||||||
|
|
||||||
nixosConfigurations = nixpkgs.lib.mapAttrs
|
nixosConfigurations = nixpkgs.lib.mapAttrs
|
||||||
(hostname: { system
|
(hostname: { system
|
||||||
, extraModules ? [ ]
|
, extraModules ? [ ]
|
||||||
|
, targetHost ? hostname
|
||||||
, nixpkgs ? inputs.nixpkgs
|
, nixpkgs ? inputs.nixpkgs
|
||||||
}: nixpkgs.lib.nixosSystem rec {
|
}: nixpkgs.lib.nixosSystem rec {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
|
@ -75,10 +120,26 @@
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
(./hosts + "/${hostname}/configuration.nix")
|
(./hosts + "/${hostname}/configuration.nix")
|
||||||
|
|
||||||
./modules
|
./modules
|
||||||
|
|
||||||
{
|
{
|
||||||
_module.args.inputs = inputs;
|
_module.args.inputs = inputs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# deployment settings
|
||||||
|
({ lib, ... }: {
|
||||||
|
options.deployment = {
|
||||||
|
targetHost = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
readOnly = true;
|
||||||
|
internal = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config.deployment = {
|
||||||
|
inherit targetHost;
|
||||||
|
};
|
||||||
|
})
|
||||||
] ++ [{
|
] ++ [{
|
||||||
nixpkgs.overlays = [ nur.overlay ];
|
nixpkgs.overlays = [ nur.overlay ];
|
||||||
}] ++ [
|
}] ++ [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue