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" "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": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1629284811, "lastModified": 1629284811,
@ -186,6 +204,18 @@
"type": "github" "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": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1720282526, "lastModified": 1720282526,
@ -207,6 +237,7 @@
"betterfox": "betterfox", "betterfox": "betterfox",
"disko": "disko", "disko": "disko",
"firefox-addons": "firefox-addons", "firefox-addons": "firefox-addons",
"flake-parts": "flake-parts",
"home-manager": "home-manager", "home-manager": "home-manager",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nix-vscode-extensions": "nix-vscode-extensions", "nix-vscode-extensions": "nix-vscode-extensions",

View file

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