| 1 | { |
| 2 | description = "A suckless system fetch utility written in C"; |
| 3 | |
| 4 | inputs = { |
| 5 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; |
| 6 | }; |
| 7 | |
| 8 | outputs = { |
| 9 | self, |
| 10 | nixpkgs, |
| 11 | }: let |
| 12 | supportedSystems = ["x86_64-linux" "aarch64-linux"]; |
| 13 | forEachSupportedSystem = f: |
| 14 | nixpkgs.lib.genAttrs supportedSystems (system: |
| 15 | f { |
| 16 | pkgs = import nixpkgs {inherit system;}; |
| 17 | }); |
| 18 | in { |
| 19 | packages = forEachSupportedSystem ({pkgs}: { |
| 20 | default = pkgs.stdenv.mkDerivation { |
| 21 | pname = "sfetch"; |
| 22 | version = "0.1.3"; |
| 23 | |
| 24 | src = self; |
| 25 | |
| 26 | nativeBuildInputs = with pkgs; [ gnumake gcc ]; |
| 27 | |
| 28 | buildPhase = '' |
| 29 | make |
| 30 | ''; |
| 31 | |
| 32 | installPhase = '' |
| 33 | make install PREFIX=$out |
| 34 | ''; |
| 35 | }; |
| 36 | }); |
| 37 | |
| 38 | devShells = forEachSupportedSystem ({pkgs}: { |
| 39 | default = pkgs.mkShell { |
| 40 | packages = with pkgs; [ gnumake gcc man-pages man-pages-posix clang-tools ]; |
| 41 | shellHook = '' |
| 42 | if [ -f ~/.bashrc ]; then |
| 43 | source ~/.bashrc |
| 44 | fi |
| 45 | ''; |
| 46 | }; |
| 47 | }); |
| 48 | }; |
| 49 | } |