refactor: use flake-parts
This commit is contained in:
parent
bc9298fc0a
commit
b8f7202f9c
2 changed files with 93 additions and 61 deletions
55
flake.lock
55
flake.lock
|
@ -36,31 +36,34 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"lastModified": 1688254665,
|
||||
"narHash": "sha256-8FHEgBrr7gYNiS/NzCxIO3m4hvtLRW9YY1nYo1ivm3o=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "267149c58a14d15f7f81b4d737308421de9d7152",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"lastModified": 1687709756,
|
||||
"narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -126,6 +129,24 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1688049487,
|
||||
"narHash": "sha256-100g4iaKC9MalDjUW9iN6Jl/OocTDtXdeAj7pEGIRh4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4bc72cae107788bf3f24f30db2e2f685c9298dc9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1678872516,
|
||||
|
@ -193,7 +214,9 @@
|
|||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
|
@ -215,6 +238,8 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"agenix": "agenix",
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixinate": "nixinate",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
|
@ -264,7 +289,9 @@
|
|||
},
|
||||
"valheim-server": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"flake-utils": [
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
|
|
99
flake.nix
99
flake.nix
|
@ -3,6 +3,9 @@
|
|||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
|
||||
agenix = {
|
||||
url = "github:ryantm/agenix";
|
||||
inputs.darwin.follows = "";
|
||||
|
@ -10,6 +13,7 @@
|
|||
};
|
||||
valheim-server = {
|
||||
url = "github:aidalgol/valheim-server-flake";
|
||||
inputs.flake-utils.follows = "flake-utils";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
|
@ -17,61 +21,62 @@
|
|||
url = "github:matthewcroughan/nixinate";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
||||
pre-commit-hooks = {
|
||||
url = "github:cachix/pre-commit-hooks.nix";
|
||||
inputs.flake-utils.follows = "flake-utils";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
} @ inputs: let
|
||||
system = "x86_64-linux";
|
||||
outputs = {flake-parts, ...} @ inputs: let
|
||||
overlays = final: prev: {
|
||||
unstable = inputs.nixpkgs-unstable.legacyPackages.${prev.system};
|
||||
};
|
||||
in {
|
||||
apps = inputs.nixinate.nixinate.${system} self;
|
||||
in
|
||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
flake = {
|
||||
nixosConfigurations.main-node = inputs.nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
{
|
||||
_module.args.nixinate = {
|
||||
host = "main-node";
|
||||
buildOn = "remote";
|
||||
hermetic = false;
|
||||
};
|
||||
nixpkgs.overlays = [overlays];
|
||||
}
|
||||
./hosts/main-node
|
||||
./config
|
||||
inputs.agenix.nixosModules.default
|
||||
inputs.valheim-server.nixosModules.default
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
nixosConfigurations.main-node = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
{
|
||||
_module.args.nixinate = {
|
||||
host = "main-node";
|
||||
buildOn = "remote";
|
||||
hermetic = false;
|
||||
perSystem = {
|
||||
pkgs,
|
||||
system,
|
||||
self',
|
||||
...
|
||||
}: {
|
||||
apps = (inputs.nixinate.nixinate.${system} inputs.self).nixinate;
|
||||
|
||||
checks.pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
alejandra.enable = true;
|
||||
nil.enable = true;
|
||||
};
|
||||
nixpkgs.overlays = [overlays];
|
||||
}
|
||||
./hosts/main-node
|
||||
./config
|
||||
inputs.agenix.nixosModules.default
|
||||
inputs.valheim-server.nixosModules.default
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
checks.${system}.pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
alejandra.enable = true;
|
||||
deadnix.enable = true;
|
||||
shellcheck.enable = true;
|
||||
stylua.enable = true;
|
||||
};
|
||||
settings.deadnix = {
|
||||
noLambdaPatternNames = true;
|
||||
noLambdaArg = true;
|
||||
};
|
||||
};
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = [inputs.agenix.packages.${system}.agenix];
|
||||
inherit (inputs.self.checks.${system}.pre-commit-check) shellHook;
|
||||
};
|
||||
|
||||
devShells.${system}.default = let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
pkgs.mkShell {
|
||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||
buildInputs = [
|
||||
inputs.agenix.packages.${system}.agenix
|
||||
];
|
||||
formatter = pkgs.alejandra;
|
||||
};
|
||||
};
|
||||
|
||||
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue