From 2a53f22a1d9d6f0cff5e7bde06420292a6d40832 Mon Sep 17 00:00:00 2001 From: Nikita Podvirnyi Date: Fri, 19 Jul 2024 13:09:04 +0200 Subject: [PATCH] feat: use nix flake instead of `shell.nix` --- .envrc | 2 +- flake.nix | 25 +++++++++++++++++++++++++ shell.nix | 27 --------------------------- 3 files changed, 26 insertions(+), 28 deletions(-) create mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/.envrc b/.envrc index 1d953f4..3550a30 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use nix +use flake diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e5b5358 --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + }; + + outputs = { self, nixpkgs, nixpkgs-unstable }: + let + pkgs = nixpkgs.legacyPackages.x86_64-linux; + pkgs-unstable = nixpkgs-unstable.legacyPackages.x86_64-linux; + + in { + devShells.x86_64-linux.default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + pkgs-unstable.rustup + pkgs-unstable.rustfmt + pkgs-unstable.clippy + + gcc + cmake + pkg-config + ]; + }; + }; +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 93763a3..0000000 --- a/shell.nix +++ /dev/null @@ -1,27 +0,0 @@ -let - nixpkgs = builtins.fetchGit { - name = "nixos-24.05"; - url = "https://github.com/nixos/nixpkgs"; - ref = "refs/heads/nixos-24.05"; - }; - - nixpkgs-unstable = builtins.fetchGit { - name = "nixos-unstable"; - url = "https://github.com/nixos/nixpkgs"; - ref = "refs/heads/nixos-unstable"; - }; - - pkgs = import nixpkgs {}; - pkgs-unstable = import nixpkgs-unstable {}; - -in pkgs.mkShell { - nativeBuildInputs = with pkgs; [ - pkgs-unstable.rustup - pkgs-unstable.rustfmt - pkgs-unstable.clippy - - gcc - cmake - pkg-config - ]; -}