A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Setup Nix environment

+193 -15
+1
.envrc
··· 1 + eval "$(lorri direnv)"
-2
.tool-versions
··· 1 - elm 0.19.1 2 - nodejs 14.6.0
+3 -13
README.md
··· 57 57 58 58 ### Building it yourself 59 59 60 - For version numbers, see `.tool-versions` and `stack.yaml`. 61 - All of these, except the last one, can be install using [homebrew](https://brew.sh/). 62 - 63 - - [Elm](https://elm-lang.org/) programming language 64 - - [Haskell](https://docs.haskellstack.org/en/stable/README/) programming language 65 - - [Node.js](https://nodejs.org/) programming language with the [Yarn](https://yarnpkg.com/) package manager 66 - - [Just](https://github.com/casey/just) command runner (improved `make`) 67 - - [Devd](https://github.com/cortesi/devd) web server for development (optional) 68 - - [Elm Format](https://github.com/avh4/elm-format) elm code formatter (optional) 69 - - [Watchexec](https://github.com/watchexec/watchexec) watching for file changes (optional) 70 - - [Elm Proofread](https://github.com/icidasset/elm-proofread) documentation tests (optional) 60 + This project uses [Nix](https://nixos.org/features.html) to manage the project's environment. If you'd like to build this project without Nix, check out the dependencies in the `shell.nix` file (most are available through Homebrew as well). 71 61 72 62 73 63 ```shell 74 64 # 🍱 75 65 76 - # 1. Install programming languages: 77 - # Elm 0.19.1 & Haskell (Stack), see links above 66 + # 1. Setup Nix environment 67 + # https://nixos.org/download.html 78 68 79 69 # 2. Install dependencies 80 70 yarn install
+26
nix/sources.json
··· 1 + { 2 + "niv": { 3 + "branch": "master", 4 + "description": "Easy dependency management for Nix projects", 5 + "homepage": "https://github.com/nmattia/niv", 6 + "owner": "nmattia", 7 + "repo": "niv", 8 + "rev": "ab9cc41caf44d1f1d465d8028e4bc0096fd73238", 9 + "sha256": "17k52n8zwp832cqifsc4458mhy4044wmk22f807171hf6p7l4xvr", 10 + "type": "tarball", 11 + "url": "https://github.com/nmattia/niv/archive/ab9cc41caf44d1f1d465d8028e4bc0096fd73238.tar.gz", 12 + "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" 13 + }, 14 + "nixpkgs": { 15 + "branch": "nixpkgs-unstable", 16 + "description": "Nix Packages collection", 17 + "homepage": null, 18 + "owner": "NixOS", 19 + "repo": "nixpkgs", 20 + "rev": "5ad1cdafe15d4ea79ae6abcddc360dd2de35b44e", 21 + "sha256": "1nn602v3ssj79rxdfl3ical10c1d632vji9nv2h0dqslmycg4aws", 22 + "type": "tarball", 23 + "url": "https://github.com/NixOS/nixpkgs/archive/5ad1cdafe15d4ea79ae6abcddc360dd2de35b44e.tar.gz", 24 + "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" 25 + } 26 + }
+138
nix/sources.nix
··· 1 + # This file has been generated by Niv. 2 + 3 + let 4 + 5 + # 6 + # The fetchers. fetch_<type> fetches specs of type <type>. 7 + # 8 + 9 + fetch_file = pkgs: spec: 10 + if spec.builtin or true then 11 + builtins_fetchurl { inherit (spec) url sha256; } 12 + else 13 + pkgs.fetchurl { inherit (spec) url sha256; }; 14 + 15 + fetch_tarball = pkgs: name: spec: 16 + let 17 + ok = str: ! builtins.isNull (builtins.match "[a-zA-Z0-9+-._?=]" str); 18 + # sanitize the name, though nix will still fail if name starts with period 19 + name' = stringAsChars (x: if ! ok x then "-" else x) "${name}-src"; 20 + in 21 + if spec.builtin or true then 22 + builtins_fetchTarball { name = name'; inherit (spec) url sha256; } 23 + else 24 + pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; 25 + 26 + fetch_git = spec: 27 + builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; }; 28 + 29 + fetch_local = spec: spec.path; 30 + 31 + fetch_builtin-tarball = name: throw 32 + ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`. 33 + $ niv modify ${name} -a type=tarball -a builtin=true''; 34 + 35 + fetch_builtin-url = name: throw 36 + ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`. 37 + $ niv modify ${name} -a type=file -a builtin=true''; 38 + 39 + # 40 + # Various helpers 41 + # 42 + 43 + # The set of packages used when specs are fetched using non-builtins. 44 + mkPkgs = sources: 45 + let 46 + sourcesNixpkgs = 47 + import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {}; 48 + hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; 49 + hasThisAsNixpkgsPath = <nixpkgs> == ./.; 50 + in 51 + if builtins.hasAttr "nixpkgs" sources 52 + then sourcesNixpkgs 53 + else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then 54 + import <nixpkgs> {} 55 + else 56 + abort 57 + '' 58 + Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or 59 + add a package called "nixpkgs" to your sources.json. 60 + ''; 61 + 62 + # The actual fetching function. 63 + fetch = pkgs: name: spec: 64 + 65 + if ! builtins.hasAttr "type" spec then 66 + abort "ERROR: niv spec ${name} does not have a 'type' attribute" 67 + else if spec.type == "file" then fetch_file pkgs spec 68 + else if spec.type == "tarball" then fetch_tarball pkgs name spec 69 + else if spec.type == "git" then fetch_git spec 70 + else if spec.type == "local" then fetch_local spec 71 + else if spec.type == "builtin-tarball" then fetch_builtin-tarball name 72 + else if spec.type == "builtin-url" then fetch_builtin-url name 73 + else 74 + abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}"; 75 + 76 + # Ports of functions for older nix versions 77 + 78 + # a Nix version of mapAttrs if the built-in doesn't exist 79 + mapAttrs = builtins.mapAttrs or ( 80 + f: set: with builtins; 81 + listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)) 82 + ); 83 + 84 + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 85 + range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1); 86 + 87 + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 88 + stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); 89 + 90 + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 91 + stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); 92 + concatStrings = builtins.concatStringsSep ""; 93 + 94 + # fetchTarball version that is compatible between all the versions of Nix 95 + builtins_fetchTarball = { url, name, sha256 }@attrs: 96 + let 97 + inherit (builtins) lessThan nixVersion fetchTarball; 98 + in 99 + if lessThan nixVersion "1.12" then 100 + fetchTarball { inherit name url; } 101 + else 102 + fetchTarball attrs; 103 + 104 + # fetchurl version that is compatible between all the versions of Nix 105 + builtins_fetchurl = { url, sha256 }@attrs: 106 + let 107 + inherit (builtins) lessThan nixVersion fetchurl; 108 + in 109 + if lessThan nixVersion "1.12" then 110 + fetchurl { inherit url; } 111 + else 112 + fetchurl attrs; 113 + 114 + # Create the final "sources" from the config 115 + mkSources = config: 116 + mapAttrs ( 117 + name: spec: 118 + if builtins.hasAttr "outPath" spec 119 + then abort 120 + "The values in sources.json should not have an 'outPath' attribute" 121 + else 122 + spec // { outPath = fetch config.pkgs name spec; } 123 + ) config.sources; 124 + 125 + # The "config" used by the fetchers 126 + mkConfig = 127 + { sourcesFile ? ./sources.json 128 + , sources ? builtins.fromJSON (builtins.readFile sourcesFile) 129 + , pkgs ? mkPkgs sources 130 + }: rec { 131 + # The sources, i.e. the attribute set of spec name to spec 132 + inherit sources; 133 + 134 + # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers 135 + inherit pkgs; 136 + }; 137 + in 138 + mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
+25
shell.nix
··· 1 + let 2 + 3 + sources = import ./nix/sources.nix; 4 + pkgs = import sources.nixpkgs {}; 5 + 6 + in 7 + 8 + pkgs.mkShell { 9 + buildInputs = [ 10 + 11 + # Dev Tools 12 + pkgs.curl 13 + pkgs.devd 14 + pkgs.just 15 + pkgs.watchexec 16 + 17 + # Language Specific 18 + pkgs.elmPackages.elm 19 + pkgs.elmPackages.elm-format 20 + pkgs.haskellPackages.stack 21 + pkgs.nodejs-14_x 22 + pkgs.yarn 23 + 24 + ]; 25 + }