From eaf2fa2e24b312162d1906960d333820835918c4 Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Sun, 22 May 2022 20:21:50 +0100 Subject: [PATCH 1/4] Add a flake to pridefetch --- flake.lock | 24 ++++++++++++++++++++++++ flake.nix | 29 +++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c6e294d --- /dev/null +++ b/flake.lock @@ -0,0 +1,24 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1653087707, + "narHash": "sha256-zfno3snrzZTWQ2B7K53QHrGZwrjnJLTRPalymrSsziU=", + "path": "/nix/store/3g25cg20m43hvsy17d7nz0jxwk79a77w-source", + "rev": "cbd40c72b2603ab54e7208f99f9b35fc158bc009", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0553d47 --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + description = "A flake to run pridefetch"; + + outputs = { self, nixpkgs }: let + system = "x86_64-linux"; + + pkgs = import nixpkgs { + inherit system; + }; + in rec { + packages."${system}".pridefetch = pkgs.stdenv.mkDerivation { + name = "pridefetch"; + buildInputs = [ + (pkgs.python39.withPackages (pythonPackages: with pythonPackages; [ + distro + ])) + ]; + unpackPhase = "true"; + installPhase = '' + mkdir -p $out/bin + cp ${./pridefetch} $out/bin/pridefetch + cp ${./packages.py} $out/bin/packages.py + chmod +x $out/bin/pridefetch + ''; + }; + + defaultPackage."${system}" = packages."${system}".pridefetch; + }; +} From 0fb0d12bb89e05de376403deb87bfff1d0492118 Mon Sep 17 00:00:00 2001 From: Skyler Date: Sun, 22 May 2022 20:43:47 +0100 Subject: [PATCH 2/4] Update README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 375d0d6..7051823 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,18 @@ You can also add pridefetch to your `$PATH` to run it anywhere
```bash mv pridefetch /usr/bin/ ``` + +## Running on NixOS +#### If your system supports flakes +You can run pridefetch quickly + +```bash +nix run github:SpyHoodle/pridefetch -- -f trans +``` + +Or install it + +``` +nix profile install github:SpyHoodle/pridefetch +pridefetch -f trans +``` From b4197e9b95ce718b12c5deb85e89cd4afe266979 Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Sun, 22 May 2022 21:00:40 +0100 Subject: [PATCH 3/4] Let flake run under all systems --- flake.nix | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/flake.nix b/flake.nix index 0553d47..fc480e8 100644 --- a/flake.nix +++ b/flake.nix @@ -4,26 +4,30 @@ outputs = { self, nixpkgs }: let system = "x86_64-linux"; - pkgs = import nixpkgs { - inherit system; - }; + forAllSystems = f: nixpkgs.lib.genAttrs nixpkgs.lib.systems.supported.hydra (system: f system); in rec { - packages."${system}".pridefetch = pkgs.stdenv.mkDerivation { - name = "pridefetch"; - buildInputs = [ - (pkgs.python39.withPackages (pythonPackages: with pythonPackages; [ - distro - ])) - ]; - unpackPhase = "true"; - installPhase = '' - mkdir -p $out/bin - cp ${./pridefetch} $out/bin/pridefetch - cp ${./packages.py} $out/bin/packages.py - chmod +x $out/bin/pridefetch - ''; - }; + packages = forAllSystems (system: let + pkgs = import nixpkgs { + inherit system; + }; + in { + pridefetch = pkgs.stdenv.mkDerivation { + name = "pridefetch"; + buildInputs = [ + (pkgs.python39.withPackages (pythonPackages: with pythonPackages; [ + distro + ])) + ]; + unpackPhase = "true"; + installPhase = '' + mkdir -p $out/bin + cp ${./pridefetch} $out/bin/pridefetch + cp ${./packages.py} $out/bin/packages.py + chmod +x $out/bin/pridefetch + ''; + }; + }); - defaultPackage."${system}" = packages."${system}".pridefetch; + defaultPackage = forAllSystems (system: self.packages.${system}.pridefetch); }; } From 26c680db8d4678c0e0bac9a5c278ff9257c6895f Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Sun, 22 May 2022 21:02:41 +0100 Subject: [PATCH 4/4] Add that to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7051823..4d2f18d 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ mv pridefetch /usr/bin/ ## Running on NixOS #### If your system supports flakes +> ⚠ Note: This has only been tried on x86_64-linux; while it may work if your system is something different I have only tested it You can run pridefetch quickly ```bash