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"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils": {
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1667395993,
|
"lastModified": 1688254665,
|
||||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
"narHash": "sha256-8FHEgBrr7gYNiS/NzCxIO3m4hvtLRW9YY1nYo1ivm3o=",
|
||||||
"owner": "numtide",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-parts",
|
||||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
"rev": "267149c58a14d15f7f81b4d737308421de9d7152",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "numtide",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-parts",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils_2": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681202837,
|
"lastModified": 1687709756,
|
||||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
"narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
"rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -126,6 +129,24 @@
|
||||||
"type": "github"
|
"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": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1678872516,
|
"lastModified": 1678872516,
|
||||||
|
@ -193,7 +214,9 @@
|
||||||
"pre-commit-hooks": {
|
"pre-commit-hooks": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": [
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
"gitignore": "gitignore",
|
"gitignore": "gitignore",
|
||||||
"nixpkgs": "nixpkgs_3",
|
"nixpkgs": "nixpkgs_3",
|
||||||
"nixpkgs-stable": "nixpkgs-stable"
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
|
@ -215,6 +238,8 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"agenix": "agenix",
|
"agenix": "agenix",
|
||||||
|
"flake-parts": "flake-parts",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
"nixinate": "nixinate",
|
"nixinate": "nixinate",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
|
@ -264,7 +289,9 @@
|
||||||
},
|
},
|
||||||
"valheim-server": {
|
"valheim-server": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils_2",
|
"flake-utils": [
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
|
|
99
flake.nix
99
flake.nix
|
@ -3,6 +3,9 @@
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
|
||||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
|
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
|
||||||
agenix = {
|
agenix = {
|
||||||
url = "github:ryantm/agenix";
|
url = "github:ryantm/agenix";
|
||||||
inputs.darwin.follows = "";
|
inputs.darwin.follows = "";
|
||||||
|
@ -10,6 +13,7 @@
|
||||||
};
|
};
|
||||||
valheim-server = {
|
valheim-server = {
|
||||||
url = "github:aidalgol/valheim-server-flake";
|
url = "github:aidalgol/valheim-server-flake";
|
||||||
|
inputs.flake-utils.follows = "flake-utils";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,61 +21,62 @@
|
||||||
url = "github:matthewcroughan/nixinate";
|
url = "github:matthewcroughan/nixinate";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
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 = {
|
outputs = {flake-parts, ...} @ inputs: let
|
||||||
self,
|
|
||||||
nixpkgs,
|
|
||||||
...
|
|
||||||
} @ inputs: let
|
|
||||||
system = "x86_64-linux";
|
|
||||||
overlays = final: prev: {
|
overlays = final: prev: {
|
||||||
unstable = inputs.nixpkgs-unstable.legacyPackages.${prev.system};
|
unstable = inputs.nixpkgs-unstable.legacyPackages.${prev.system};
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
apps = inputs.nixinate.nixinate.${system} self;
|
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 {
|
perSystem = {
|
||||||
inherit system;
|
pkgs,
|
||||||
modules = [
|
system,
|
||||||
{
|
self',
|
||||||
_module.args.nixinate = {
|
...
|
||||||
host = "main-node";
|
}: {
|
||||||
buildOn = "remote";
|
apps = (inputs.nixinate.nixinate.${system} inputs.self).nixinate;
|
||||||
hermetic = false;
|
|
||||||
|
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 {
|
devShells.default = pkgs.mkShell {
|
||||||
src = ./.;
|
buildInputs = [inputs.agenix.packages.${system}.agenix];
|
||||||
hooks = {
|
inherit (inputs.self.checks.${system}.pre-commit-check) shellHook;
|
||||||
alejandra.enable = true;
|
};
|
||||||
deadnix.enable = true;
|
|
||||||
shellcheck.enable = true;
|
|
||||||
stylua.enable = true;
|
|
||||||
};
|
|
||||||
settings.deadnix = {
|
|
||||||
noLambdaPatternNames = true;
|
|
||||||
noLambdaArg = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
devShells.${system}.default = let
|
formatter = pkgs.alejandra;
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
|
||||||
in
|
|
||||||
pkgs.mkShell {
|
|
||||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
|
||||||
buildInputs = [
|
|
||||||
inputs.agenix.packages.${system}.agenix
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue