flake

Francesco Saccone's Nix flake.
git clone https://git.francescosaccone.com/flake
Log | Files | Refs | README | LICENSE

flake.nix (2855B)


      1 {
      2   description = "Francesco Saccone's Nix flake.";
      3 
      4   inputs = {
      5     nixpkgs = {
      6       url = "github:nixos/nixpkgs/release-24.11";
      7     };
      8     home-manager = {
      9       url = "github:nix-community/home-manager/release-24.11";
     10       inputs.nixpkgs.follows = "nixpkgs";
     11     };
     12     treefmt-nix = {
     13       url = "github:numtide/treefmt-nix";
     14       inputs.nixpkgs.follows = "nixpkgs";
     15     };
     16     disko = {
     17       url = "github:nix-community/disko";
     18       inputs.nixpkgs.follows = "nixpkgs";
     19     };
     20     openpgp-key = {
     21       url = "https://francescosaccone.com/public/francescosaccone.asc";
     22       flake = false;
     23     };
     24     password-store = {
     25       url = "git://git.francescosaccone.com/password-store";
     26       flake = false;
     27     };
     28     site = {
     29       url = "git://git.francescosaccone.com/site";
     30       flake = false;
     31     };
     32   };
     33 
     34   outputs =
     35     inputs:
     36     let
     37       lib =
     38         let
     39           systems = [
     40             "aarch64-linux"
     41             "x86_64-linux"
     42           ];
     43         in
     44         {
     45           forEachSystem = import ./lib/for-each-system.nix {
     46             inherit (inputs) nixpkgs;
     47             inherit systems;
     48           };
     49           forEachSystemPkgs = import ./lib/for-each-system-pkgs.nix {
     50             inherit (inputs) nixpkgs;
     51             inherit systems inputs;
     52           };
     53           makeHost = import ./lib/make-host.nix {
     54             inherit (inputs) nixpkgs;
     55             inherit inputs;
     56           };
     57           getPkgs = import ./lib/get-pkgs.nix {
     58             inherit (inputs) nixpkgs;
     59             inherit inputs;
     60           };
     61         };
     62 
     63       treefmtEval = lib.forEachSystemPkgs (
     64         { system, pkgs }: inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix
     65       );
     66     in
     67     {
     68       checks = lib.forEachSystem (
     69         { system }:
     70         {
     71           formatting = treefmtEval.${system}.config.build.check inputs.self;
     72         }
     73       );
     74 
     75       packages = lib.forEachSystem (
     76         {
     77           system,
     78         }:
     79         import ./packages inputs.nixpkgs.legacyPackages.${system}
     80       );
     81 
     82       formatter = lib.forEachSystem (
     83         {
     84           system,
     85         }:
     86         treefmtEval.${system}.config.build.wrapper
     87       );
     88 
     89       overlays.default = final: prev: import ./packages final.pkgs;
     90 
     91       nixosModules = {
     92         default = import ./modules/nixos;
     93         home-manager = import ./modules/home-manager;
     94       };
     95 
     96       nixosConfigurations = {
     97         "laptop" = lib.makeHost "laptop" {
     98           additionalModules = [
     99             inputs.home-manager.nixosModules.home-manager
    100           ];
    101         };
    102         "git-server" = lib.makeHost "git-server" {
    103           additionalModules = [
    104             inputs.disko.nixosModules.disko
    105           ];
    106         };
    107         "main-server" = lib.makeHost "main-server" {
    108           additionalModules = [
    109             inputs.disko.nixosModules.disko
    110           ];
    111         };
    112       };
    113     };
    114 }