From 61d95a8a11a91f6c38bdaeda20c49ca223c9dbf0 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Fri, 15 Dec 2023 20:42:56 +0100 Subject: [PATCH] feat: initial flake devshell for hledger --- .envrc | 1 + .gitignore | 1 + flake.lock | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 45 +++++++++++++++++++++ 4 files changed, 162 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix 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 new file mode 100644 index 0000000..92b2793 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.direnv diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..edd2b41 --- /dev/null +++ b/flake.lock @@ -0,0 +1,115 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "nixpkgs": "nixpkgs", + "systems": "systems" + }, + "locked": { + "lastModified": 1701787589, + "narHash": "sha256-ce+oQR4Zq9VOsLoh9bZT8Ip9PaMLcjjBUHVPzW5d7Cw=", + "owner": "numtide", + "repo": "devshell", + "rev": "44ddedcbcfc2d52a76b64fb6122f209881bd3e1e", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1701473968, + "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1677383253, + "narHash": "sha256-UfpzWfSxkfXHnb4boXZNaKsAcUrZT9Hw+tao1oZxd08=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9952d6bc395f5841262b006fbace8dd7e143b634", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1701253981, + "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1702312524, + "narHash": "sha256-gkZJRDBUCpTPBvQk25G0B7vfbpEYM5s5OZqghkjZsnE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a9bf124c46ef298113270b1f84a164865987a91c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "devshell": "devshell", + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ef555c3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,45 @@ +{ + description = "finances environment"; + + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + inputs.devshell.url = "github:numtide/devshell"; + inputs.flake-parts.url = "github:hercules-ci/flake-parts"; + + outputs = inputs@{ self, flake-parts, devshell, nixpkgs }: + flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + devshell.flakeModule + ]; + + systems = [ + "aarch64-darwin" + "aarch64-linux" + "i686-linux" + "x86_64-darwin" + "x86_64-linux" + ]; + + perSystem = { pkgs, ... }: { + devshells.default = { + # Add additional packages you'd like to be available in your devshell + # PATH here + devshell.packages = with pkgs; [ + hledger + hledger-web + ]; + commands = [ + # Example + #{ + # help = pkgs.cachix.meta.description; + # name = pkgs.cachix.pname; + # package = pkgs.cachix; + #} + ]; + # Add extra shell environment variables or aliases to be set in the + # devshell + bash.extra = '' + ''; + }; + }; + }; +}