{ description = "nixfiles"; # `flake.lock` generation is not computable[1], thus it is impossible to add # helper functions to manage inputs. # # [1]: https://github.com/NixOS/nix/issues/5373 inputs = { nixpkgs = { # type = "path"; # path = "/home/azahi/src/nixpkgs"; type = "github"; owner = "NixOS"; repo = "nixpkgs"; ref = "nixpkgs-unstable"; }; nixpkgs-master = { type = "github"; owner = "NixOS"; repo = "nixpkgs"; ref = "master"; }; nixpkgs-stable = { type = "github"; owner = "NixOS"; repo = "nixpkgs"; ref = "release-22.11"; }; # For testing PRs and stuff. # nixpkgs-local = { # type = "path"; # path = "/home/azahi/src/nixpkgs"; # }; nixos-hardware = { type = "github"; owner = "NixOS"; repo = "nixos-hardware"; ref = "master"; }; nur = { type = "github"; owner = "nix-community"; repo = "NUR"; ref = "master"; }; darwin = { type = "github"; owner = "LnL7"; repo = "nix-darwin"; ref = "master"; inputs.nixpkgs.follows = "nixpkgs"; }; home-manager = { # type = "path"; # path = "/home/azahi/src/home-manager"; type = "github"; owner = "nix-community"; repo = "home-manager"; ref = "master"; inputs.nixpkgs.follows = "nixpkgs"; }; impermanence = { type = "github"; owner = "nix-community"; repo = "impermanence"; ref = "master"; }; nix-vscode-extensions = { type = "github"; owner = "nix-community"; repo = "nix-vscode-extensions"; ref = "master"; inputs = { flake-compat.follows = "flake-compat"; flake-utils.follows = "flake-utils"; nixpkgs.follows = "nixpkgs"; }; }; arkenfox-nixos = { type = "github"; owner = "dwarfmaster"; repo = "arkenfox-nixos"; ref = "main"; inputs = { nixpkgs.follows = "nixpkgs"; flake-compat.follows = "flake-compat"; pre-commit.follows = "pre-commit-hooks"; flake-utils.follows = "flake-utils"; }; }; # TODO Check out https://github.com/nix-community/mineflake nix-minecraft = { type = "github"; owner = "Infinidoge"; repo = "nix-minecraft"; ref = "master"; inputs = { nixpkgs.follows = "nixpkgs"; flake-utils.follows = "flake-utils"; }; }; pollymc = { type = "github"; owner = "fn2006"; repo = "PollyMC"; ref = "6.3"; inputs = { flake-compat.follows = "flake-compat"; nixpkgs.follows = "nixpkgs"; }; }; dns-nix = { type = "github"; owner = "kirelagin"; repo = "dns.nix"; ref = "master"; inputs = { flake-utils.follows = "flake-utils"; nixpkgs.follows = "nixpkgs"; }; }; simple-nixos-mailserver = { type = "gitlab"; owner = "simple-nixos-mailserver"; repo = "nixos-mailserver"; ref = "master"; inputs = { flake-compat.follows = "flake-compat"; nixpkgs-22_11.follows = "nixpkgs-stable"; nixpkgs.follows = "nixpkgs"; utils.follows = "flake-utils"; }; }; alertmanager-ntfy = { type = "github"; owner = "pinpox"; repo = "alertmanager-ntfy"; ref = "main"; inputs = { flake-compat.follows = "flake-compat"; flake-utils.follows = "flake-utils"; nixpkgs.follows = "nixpkgs"; }; }; flake-utils = { type = "github"; owner = "numtide"; repo = "flake-utils"; ref = "main"; }; flake-registry = { type = "github"; owner = "NixOS"; repo = "flake-registry"; ref = "master"; flake = false; }; agenix = { type = "github"; owner = "ryantm"; repo = "agenix"; ref = "main"; inputs = { nixpkgs.follows = "nixpkgs"; darwin.follows = "darwin"; }; }; pre-commit-hooks = { type = "github"; owner = "cachix"; repo = "pre-commit-hooks.nix"; ref = "master"; inputs = { flake-compat.follows = "flake-compat"; flake-utils.follows = "flake-utils"; nixpkgs.follows = "nixpkgs"; nixpkgs-stable.follows = "nixpkgs-stable"; }; }; xmonad-ng = { # type = "path"; # path = "/home/azahi/src/xmonad-ng"; url = "git+https://git.azahi.cc/xmonad-ng?ref=master"; inputs = { flake-utils.follows = "flake-utils"; nixpkgs.follows = "nixpkgs"; }; }; azahi-cc = { url = "git+https://git.azahi.cc/azahi-cc?ref=master"; flake = false; }; nmap-vulners = { type = "github"; owner = "vulnersCom"; repo = "nmap-vulners"; ref = "master"; flake = false; }; nmap-vulscan = { type = "github"; owner = "scipag"; repo = "vulscan"; ref = "master"; flake = false; }; flake-compat = { type = "github"; owner = "edolstra"; repo = "flake-compat"; ref = "master"; flake = false; }; }; outputs = inputs: with inputs; let lib = nixpkgs.lib.extend (import ./lib); in flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; overlays = [self.overlays.default]; }; in { packages = with lib; (mapAttrs (_: c: c.config.system.build.toplevel) (builtins.removeAttrs self.nixosConfigurations ["iso-arm" "iso-x86"])) // (let buildIsoImage = name: self.nixosConfigurations.${name}.config.system.build.isoImage; in { iso-arm = buildIsoImage "iso-arm"; iso-x86 = buildIsoImage "iso-x86"; }) // { default = pkgs.nixfiles; }; apps.${system}.default = { type = "app"; package = "${self.packages.${system}.default}/bin/nixfiles"; }; devShells.default = pkgs.mkShell { inherit (self.checks.${system}.preCommit) shellHook; }; formatter = with pkgs; writeShellScriptBin "fmt" '' ${alejandra}/bin/alejandra --quiet "$@" ''; checks.preCommit = pre-commit-hooks.lib.${system}.run { src = builtins.path { name = "nixfiles"; path = ./.; }; hooks = { alejandra.enable = true; deadnix.enable = true; editorconfig-checker.enable = true; prettier = { enable = true; files = "\\.css"; }; shellcheck.enable = true; shfmt.enable = true; statix.enable = true; typos = { enable = true; types = ["text"]; }; yamllint.enable = true; promtool = { enable = true; name = "promtool"; description = "Check Prometheus rules"; entry = "${pkgs.prometheus.cli}/bin/promtool check rules"; files = "(?x)^(modules/nixos/monitoring/rules/.*\.yaml)$"; }; nixpkgs-lint = { enable = true; name = "nixpkgs-lint"; description = "Semantic linter for Nixpkgs using tree-sitter"; entry = "${pkgs.nixpkgs-lint}/bin/nixpkgs-lint"; files = "(?x)^(packages/.*\.nix)$"; }; }; settings.deadnix.edit = true; }; }) // (let importConfigurations = dir: import dir {inherit inputs lib;}; in { inherit lib; modules.nixfiles = import ./modules/common; nixosModules.nixfiles = import ./modules/nixos; nixosConfigurations = importConfigurations ./nixosConfigurations; darwinModules.nixfiles = import ./modules/darwin; darwinConfigurations = importConfigurations ./darwinConfigurations; overlays.default = final: prev: rec { bruh = prev.callPackage ./packages/bruh.nix {}; mpv-autosub = prev.callPackage ./packages/mpv-autosub.nix {}; myip = prev.callPackage ./packages/myip.nix {}; nixfiles = prev.callPackage ./packages/nixfiles.nix {}; throttled = prev.callPackage ./packages/throttled.nix {}; logcli = prev.grafana-loki.overrideAttrs (_: super: { pname = "logcli"; subPackages = ["cmd/logcli"]; nativeBuildInputs = super.nativeBuildInputs ++ [final.installShellFiles]; postInstall = '' installShellCompletion --cmd logcli \ --bash <($out/bin/logcli --completion--script-bash) \ --zsh <($out/bin/logcli --completion-script-zsh) ''; preFixup = null; }); }; }); }