/ flake.nix
flake.nix
1 { 2 inputs = { 3 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 4 crane.url = "github:ipetkov/crane"; 5 radicle-update.url = "git+https://radicle.defelo.de/zPrhdopkKmKWdeEJJHx6TvKM832X.git"; 6 }; 7 8 outputs = 9 { 10 self, 11 nixpkgs, 12 crane, 13 radicle-update, 14 ... 15 }: 16 17 let 18 inherit (nixpkgs) lib; 19 20 eachSystem = f: lib.genAttrs systems (s: f nixpkgs.legacyPackages.${s}); 21 systems = [ 22 "x86_64-linux" 23 "aarch64-linux" 24 "x86_64-darwin" 25 "aarch64-darwin" 26 ]; 27 in 28 29 { 30 packages = eachSystem (pkgs: { 31 default = pkgs.callPackage ./nix/package.nix { inherit crane; }; 32 33 update-deps = pkgs.callPackage ./update-deps.nix { inherit radicle-update; }; 34 }); 35 36 nixosModules.default = import ./nix/module.nix self; 37 38 defaultConfig = lib.importTOML ./config.toml; 39 inherit (lib.importTOML ./users.toml) users; 40 41 devShells = eachSystem (pkgs: { 42 default = pkgs.callPackage ./nix/dev.nix { }; 43 }); 44 45 formatter = eachSystem ( 46 pkgs: 47 pkgs.treefmt.withConfig { 48 settings = lib.mkMerge [ 49 ./treefmt.nix 50 { _module.args = { inherit pkgs; }; } 51 ]; 52 } 53 ); 54 55 checks = eachSystem (pkgs: { 56 inherit (self.packages.${pkgs.stdenv.hostPlatform.system}.default) clippy; 57 packages = pkgs.linkFarm "packages" self.packages.${pkgs.stdenv.hostPlatform.system}; 58 devShells = pkgs.linkFarm "devShells" self.devShells.${pkgs.stdenv.hostPlatform.system}; 59 fmt = pkgs.runCommand "fmt-check" { } '' 60 cp -r --no-preserve=mode ${self} repo 61 ${lib.getExe self.formatter.${pkgs.stdenv.hostPlatform.system}} -C repo --ci 62 touch $out 63 ''; 64 }); 65 }; 66 67 nixConfig = { 68 abort-on-warn = true; 69 commit-lock-file-summary = "chore: update flake.lock"; 70 extra-substituters = "https://attic.defelo.de/aocbot"; 71 extra-trusted-public-keys = "aocbot:VsmC5e+1JT3/LE+5S3idYIWokY9aUfSesls0M0g2sfI="; 72 }; 73 }