about summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2022-08-12 22:53:53 +0300
committerAzat Bahawi <azat@bahawi.net>2022-08-12 22:53:53 +0300
commit61b94f0dd06cac0f7dcd38cce80f2a7ab8376098 (patch)
treeb703a9fe11eae6c4cae4e4682f02caf0caa171d0 /flake.nix
2022-08-12
Diffstat (limited to '')
-rw-r--r--flake.nix242
1 files changed, 242 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..5f1ad07
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,242 @@
+{
+  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 = "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.05";
+    };
+
+    nixos-hardware = {
+      type = "github";
+      owner = "NixOS";
+      repo = "nixos-hardware";
+      ref = "master";
+    };
+
+    nur = {
+      type = "github";
+      owner = "nix-community";
+      repo = "NUR";
+      ref = "master";
+    };
+
+    home-manager = {
+      type = "github";
+      owner = "nix-community";
+      repo = "home-manager";
+      ref = "master";
+      inputs = {
+        nixpkgs.follows = "nixpkgs";
+        utils.follows = "flake-utils";
+      };
+    };
+
+    emacs-overlay = {
+      type = "github";
+      owner = "nix-community";
+      repo = "emacs-overlay";
+      ref = "master";
+      inputs = {
+        flake-utils.follows = "flake-utils";
+        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 = {
+        nixpkgs-22_05.follows = "nixpkgs-stable";
+        nixpkgs.follows = "nixpkgs";
+        utils.follows = "flake-utils";
+      };
+    };
+
+    alertmanager-gotify = {
+      type = "git";
+      url = "https://git.mbosch.me/ma27/alertmanager-gotify";
+      inputs = {
+        flake-utils.follows = "flake-utils";
+        nixpkgs.follows = "nixpkgs";
+      };
+    };
+
+    flake-utils = {
+      type = "github";
+      owner = "numtide";
+      repo = "flake-utils";
+      ref = "master";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
+
+    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";
+    };
+
+    pre-commit-hooks = {
+      type = "github";
+      owner = "cachix";
+      repo = "pre-commit-hooks.nix";
+      ref = "master";
+      inputs = {
+        flake-utils.follows = "flake-utils";
+        nixpkgs.follows = "nixpkgs";
+      };
+    };
+
+    xmonad-ng = {
+      type = "gitlab";
+      owner = "azahi";
+      repo = "xmonad-ng";
+      ref = "master";
+      # type = "path";
+      # path = "/home/azahi/src/xmonad-ng";
+      inputs = {
+        flake-utils.follows = "flake-utils";
+        nixpkgs.follows = "nixpkgs";
+        pre-commit-hooks.follows = "pre-commit-hooks";
+      };
+    };
+
+    azahi-cc = {
+      type = "gitlab";
+      owner = "azahi";
+      repo = "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;
+    };
+  };
+
+  outputs = inputs:
+    with inputs; let
+      lib = nixpkgs.lib.extend (import ./lib);
+    in
+      flake-utils.lib.eachSystem ["x86_64-linux"]
+      (system: let
+        pkgs = import nixpkgs {
+          inherit system;
+          overlays = [self.overlays.default];
+        };
+      in {
+        packages.default = pkgs.nixfiles.override {
+          nixfilesSrc = ".";
+        };
+
+        apps.${system}.default = {
+          type = "app";
+          package = "${self.packages.${system}.nixfiles}/bin/nixfiles";
+        };
+
+        devShells.default = pkgs.mkShell {
+          inherit (self.checks.${system}.preCommit) shellHook;
+          packages = with pkgs; [
+            pyright
+            python310
+            rnix-lsp
+          ];
+        };
+
+        formatter = pkgs.alejandra;
+
+        checks.preCommit = pre-commit-hooks.lib.${system}.run {
+          src = ./.;
+          hooks = {
+            alejandra.enable = true;
+            black.enable = true;
+            flake8 = {
+              enable = true;
+              entry = "${pkgs.python310Packages.flake8}/bin/flake8";
+              types = ["file" "python"];
+            };
+            isort.enable = true;
+            prettier = {
+              enable = true;
+              types = [];
+              files = "\\.css";
+            };
+            shellcheck.enable = true;
+            shfmt.enable = true;
+            statix.enable = true;
+          };
+        };
+      })
+      // {
+        inherit lib;
+
+        nixosModules.nixfiles = import ./modules/nixfiles;
+
+        nixosConfigurations =
+          import ./configurations {inherit inputs lib;};
+
+        overlays.default = final: _: {
+          UltimMC = final.libsForQt5.callPackage ./packages/ultimmc.nix {};
+          bruh = final.callPackage ./packages/bruh.nix {};
+          mpv-autosub = final.callPackage ./packages/mpv-autosub.nix {};
+          myip = final.callPackage ./packages/myip.nix {};
+          nixfiles = final.callPackage ./packages/nixfiles.nix {};
+          throttled = final.callPackage ./packages/throttled.nix {};
+        };
+      };
+}

Consider giving Nix/NixOS a try! <3