From 8b19fa92c0a849047df8b94a1dd505f544f3d09a Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Sat, 20 Nov 2021 01:36:34 +0000 Subject: [PATCH] Replace shell.nix and defualt.nix with flakes --- default.nix | 22 ---------------------- flake.lock | 43 +++++++++++++++++++++++++++++++++++++++++++ flake.nix | 45 +++++++++++++++++++++++++++++++++++++++++++++ shell.nix | 8 -------- 4 files changed, 88 insertions(+), 30 deletions(-) delete mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/default.nix b/default.nix deleted file mode 100644 index 366f779..0000000 --- a/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ pkgs ? import { } }: -with pkgs; - -rustPlatform.buildRustPackage rec { - name = "rustybar"; - version = "0.1"; - src = ./.; - cargoLock.lockFile = ./Cargo.lock; - RUSTC_BOOTSTRAP = 1; - doCheck = false; - nativeBuildInputs = [ pkgconfig ]; - buildInputs = [ dbus ]; - - meta = with lib; { - homepage = "https://github.com/mildlyfunctionalgays/rustybar"; - description = "swaybar/i3bar command in Rust"; - maintainers = with maintainers; [ artemist ]; - license = with licenses; [ mit ]; - platforms = platforms.linux; - }; -} - diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6186a53 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1637186689, + "narHash": "sha256-NU7BhgnwA/3ibmCeSzFK6xGi+Bari9mPfn+4cBmyEjw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7fad01d9d5a3f82081c00fb57918d64145dc904c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "utils": { + "locked": { + "lastModified": 1637014545, + "narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "bba5dcc8e0b20ab664967ad83d24d64cb64ec4f4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..51288c4 --- /dev/null +++ b/flake.nix @@ -0,0 +1,45 @@ +{ + description = "sway/i3bar command in Rust"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, utils }: + let + supportedSystems = nixpkgs.lib.platforms.unix; + in + utils.lib.eachSystem supportedSystems (system: + let pkgs = import nixpkgs { inherit system; }; + in + rec { + packages.rustybar = with pkgs; rustPlatform.buildRustPackage rec { + name = "rustybar"; + version = "0.1"; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + RUSTC_BOOTSTRAP = 1; + doCheck = false; + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ dbus ]; + + meta = with lib; { + homepage = "https://github.com/mildlyfunctionalgays/rustybar"; + description = "swaybar/i3bar command in Rust"; + maintainers = with maintainers; [ artemist ]; + license = with licenses; [ mit ]; + platforms = supportedSystems; + }; + }; + defaultPackage = packages.rustybar; + + apps.rustybar = utils.lib.mkApp { drv = packages.rustybar; }; + defaultApp = apps.rustybar; + + devShells.rustybar = with pkgs; mkShell { + packages = [ pkgconfig dbus rustup ]; + }; + devShell = devShells.rustybar; + }); +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 30a357d..0000000 --- a/shell.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs ? import { } }: - -with pkgs; stdenv.mkDerivation { - name = "rustybar-env"; - nativeBuildInputs = [ pkgconfig ]; - buildInputs = [ dbus rustup ]; -} -