diff options
| author | Fuwn <[email protected]> | 2024-10-10 18:21:48 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-10-10 18:21:48 -0700 |
| commit | 0c8e85d61f7cad99f4c0a7241d0a8b9442a6fddd (patch) | |
| tree | ee1000ec8521b2964179f213998c59a30909414e /flake.nix | |
| download | yae-0c8e85d61f7cad99f4c0a7241d0a8b9442a6fddd.tar.xz yae-0c8e85d61f7cad99f4c0a7241d0a8b9442a6fddd.zip | |
feat: initial release
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..64e2fc0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,111 @@ +{ + description = "Nix Dependency Manager"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + systems.url = "github:nix-systems/default"; + + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; + + flake-utils = { + url = "github:numtide/flake-utils"; + inputs.systems.follows = "systems"; + }; + + pre-commit-hooks = { + url = "github:cachix/git-hooks.nix"; + + inputs = { + flake-compat.follows = "flake-compat"; + nixpkgs.follows = "nixpkgs"; + }; + }; + }; + + outputs = + { + self, + nixpkgs, + flake-utils, + pre-commit-hooks, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + name = "wiene"; + + meta = with pkgs.lib; { + description = "Nix Dependency Manager"; + homepage = "https://github.com/Fuwn/${name}"; + license = licenses.gpl3Only; + maintainers = [ maintainers.Fuwn ]; + mainPackage = name; + platforms = platforms.linux; + }; + + wiene = + pkgs.buildGo122Module.override { stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv; } + rec { + inherit meta; + + pname = name; + version = "2024.10.10"; + src = pkgs.lib.cleanSource ./.; + vendorHash = "sha256-mN/QjzJ4eGfbW1H92cCKvC0wDhCR6IUes2HCZ5YBdPA="; + buildInputs = [ pkgs.musl ]; + + ldflags = [ + "-s" + "-w" + "-linkmode=external" + "-extldflags=-static" + "-X main.Version=${version}" + "-X main.Commit=${version}" + ]; + }; + in + { + packages = { + default = wiene; + ${name} = self.packages.${system}.default; + }; + + apps = { + default = { + inherit meta; + + type = "app"; + program = "${self.packages.${system}.default}/bin/${name}"; + }; + + ${name} = self.apps.${system}.default; + }; + + formatter = nixpkgs.legacyPackages."${system}".nixfmt-rfc-style; + + checks.pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + + hooks = { + deadnix.enable = true; + flake-checker.enable = true; + nixfmt-rfc-style.enable = true; + statix.enable = true; + }; + }; + + devShells.default = nixpkgs.legacyPackages.${system}.mkShell { + inherit (self.checks.${system}.pre-commit-check) shellHook; + + buildInputs = self.checks.${system}.pre-commit-check.enabledPackages ++ [ + pkgs.go_1_22 + ]; + }; + } + ); +} |