diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 62727a1..3e409ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ target* result* +.direnv diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..1b00513 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1746904237, + "narHash": "sha256-3e+AVBczosP5dCLQmMoMEogM57gmZ2qrVSrmq9aResQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d89fc19e405cb2d55ce7cc114356846a0ee5e956", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..bcca377 --- /dev/null +++ b/flake.nix @@ -0,0 +1,22 @@ +{ + description = "Superfreq"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + systems.url = "github:nix-systems/default-linux"; + }; + + outputs = inputs @ { + self, + nixpkgs, + systems, + }: let + inherit (nixpkgs) lib; + eachSystem = lib.genAttrs (import inputs.systems); + pkgsFor = eachSystem (system: nixpkgs.legacyPackages.${system}); + in { + devShells = eachSystem (system: { + default = pkgsFor.${system}.callPackage ./nix/shell.nix {}; + }); + }; +} diff --git a/nix/shell.nix b/nix/shell.nix new file mode 100644 index 0000000..27ee5b7 --- /dev/null +++ b/nix/shell.nix @@ -0,0 +1,20 @@ +{ + mkShell, + rust-analyzer-unwrapped, + rustfmt, + clippy, + cargo, + rustc, + rustPlatform, +}: +mkShell { + packages = [ + cargo + clippy + rustc + rustfmt + rust-analyzer-unwrapped + ]; + + env.RUST_SRC_PATH = "${rustPlatform.rustLibSrc}"; +}