Make use of flake-parts

This commit is contained in:
SebastianStork 2024-07-11 14:34:54 +02:00
parent 8dafb43cda
commit 2cd22d7f60
2 changed files with 74 additions and 35 deletions

31
flake.lock generated
View file

@ -75,6 +75,24 @@
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1719994518,
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1629284811,
@ -186,6 +204,18 @@
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1719876945,
"narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1720282526,
@ -207,6 +237,7 @@
"betterfox": "betterfox",
"disko": "disko",
"firefox-addons": "firefox-addons",
"flake-parts": "flake-parts",
"home-manager": "home-manager",
"nix-index-database": "nix-index-database",
"nix-vscode-extensions": "nix-vscode-extensions",

View file

@ -2,6 +2,8 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
@ -50,34 +52,39 @@
};
outputs =
{ self, nixpkgs, ... }@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
{
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ];
flake = {
nixosConfigurations = {
north = nixpkgs.lib.nixosSystem {
north = inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit self inputs;
inherit (inputs) self;
inherit inputs;
};
modules = [
./hosts/north
"${self}/users/seb/@north"
"${inputs.self}/users/seb/@north"
];
};
inspiron = nixpkgs.lib.nixosSystem {
inspiron = inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit self inputs;
inherit (inputs) self;
inherit inputs;
};
modules = [
./hosts/inspiron
"${self}/users/seb/@inspiron"
"${inputs.self}/users/seb/@inspiron"
];
};
};
};
devShells.${system}.sops = pkgs.mkShell {
perSystem =
{ pkgs, ... }:
{
devShells.sops = pkgs.mkShell {
packages = [
pkgs.sops
pkgs.age
@ -85,11 +92,12 @@
];
};
formatter.${system} =
formatter =
(inputs.treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs.nixfmt.enable = true;
programs.prettier.enable = true;
}).config.build.wrapper;
};
};
}