From cbc9c809a00e4bb9c53d964d610c23e6ff38f150 Mon Sep 17 00:00:00 2001 From: Michaili K Date: Tue, 21 May 2024 20:28:05 +0200 Subject: [PATCH] Create Nix flake devshell --- .envrc | 4 ++++ .gitignore | 3 ++- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 20 ++++++++++++++++++++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..7fd05db3e --- /dev/null +++ b/.envrc @@ -0,0 +1,4 @@ +if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4=" +fi +use flake diff --git a/.gitignore b/.gitignore index 4ed319bec..915f51406 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /target/ /Playlists/ /test/ +/.direnv/ *.json *.txt -nb*.xml \ No newline at end of file +nb*.xml diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..cdb8ce52c --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1716218643, + "narHash": "sha256-i/E7gzQybvcGAYDRGDl39WL6yVk30Je/NXypBz6/nmM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a8695cbd09a7ecf3376bd62c798b9864d20f86ee", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..dfb337e18 --- /dev/null +++ b/flake.nix @@ -0,0 +1,20 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-23.11"; + }; + outputs = { + self, + nixpkgs, + }: let + mapPkgsForEachSystem = callback: + nixpkgs.lib.genAttrs + nixpkgs.lib.systems.flakeExposed + (system: callback nixpkgs.legacyPackages.${system}); + in { + devShells = mapPkgsForEachSystem (pkgs: { + default = pkgs.mkShellNoCC { + packages = with pkgs; [openjdk11 maven]; + }; + }); + }; +}