From 0174ad26a105a94bb8846d9dd3c3e6e1a5467a99 Mon Sep 17 00:00:00 2001 From: Victor Fuentes Date: Tue, 7 Feb 2023 14:34:59 -0500 Subject: [PATCH] Update nix files --- default.nix | 23 ++++++++------- flake.lock | 81 +++++++++++------------------------------------------ flake.nix | 43 +++++++++++++++------------- 3 files changed, 52 insertions(+), 95 deletions(-) diff --git a/default.nix b/default.nix index 2cccff2..9e4cc0c 100644 --- a/default.nix +++ b/default.nix @@ -1,10 +1,13 @@ -(import - ( - let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; - } - ) - { src = ./.; } -).defaultNix +{ pkgs ? import { } +, lib ? import +}: +pkgs.rustPlatform.buildRustPackage { + pname = "nix-editor"; + version = "0.3.0"; + + src = [ ./. ]; + + cargoLock = { + lockFile = ./Cargo.lock; + }; +} diff --git a/flake.lock b/flake.lock index 6e768b8..e0781b3 100644 --- a/flake.lock +++ b/flake.lock @@ -1,22 +1,28 @@ { "nodes": { - "flake-compat": { - "flake": false, + "nixpkgs": { "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "lastModified": 1675673983, + "narHash": "sha256-8hzNh1jtiPxL5r3ICNzSmpSzV7kGb3KwX+FS5BWJUTo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5a350a8f31bb7ef0c6e79aea3795a890cf7743d4", "type": "github" }, "original": { - "owner": "edolstra", - "repo": "flake-compat", + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", "type": "github" } }, - "flake-utils": { + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "utils": { "locked": { "lastModified": 1667395993, "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", @@ -30,61 +36,6 @@ "repo": "flake-utils", "type": "github" } - }, - "naersk": { - "inputs": { - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1671096816, - "narHash": "sha256-ezQCsNgmpUHdZANDCILm3RvtO1xH8uujk/+EqNvzIOg=", - "owner": "nix-community", - "repo": "naersk", - "rev": "d998160d6a076cfe8f9741e56aeec7e267e3e114", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "naersk", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1674641431, - "narHash": "sha256-qfo19qVZBP4qn5M5gXc/h1MDgAtPA5VxJm9s8RUAkVk=", - "path": "/nix/store/714kd9iay1f89hspfp62f6xhch67n733-source", - "rev": "9b97ad7b4330aacda9b2343396eb3df8a853b4fc", - "type": "path" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1675273418, - "narHash": "sha256-tpYc4TEGvDzh9uRf44QemyQ4TpVuUbxb07b2P99XDbM=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "4d7c2644dbac9cf8282c0afe68fca8f0f3e7b2db", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", - "naersk": "naersk", - "nixpkgs": "nixpkgs_2" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index d5b8611..c228e71 100644 --- a/flake.nix +++ b/flake.nix @@ -3,33 +3,36 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; - naersk.url = "github:nix-community/naersk"; - flake-compat = { - url = "github:edolstra/flake-compat"; - flake = false; - }; + utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, flake-utils, naersk, ... }: - flake-utils.lib.eachDefaultSystem (system: + outputs = { self, nixpkgs, utils, ... }: + utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; - naersk-lib = naersk.lib."${system}"; + name = "nix-editor"; in - { - packages.nixeditor = naersk-lib.buildPackage { - pname = "nix-editor"; - root = ./.; - }; + rec + { + packages.${name} = pkgs.callPackage ./default.nix { + inherit (inputs); + }; + + # `nix build` + defaultPackage = packages.${name}; - defaultPackage = self.packages.${system}.nixeditor; + # `nix run` + apps.${name} = utils.lib.mkApp { + inherit name; + drv = packages.${name}; + }; + defaultApp = apps.${name}; - checks = self.packages.${system}; - hydraJobs = self.packages.${system}; + checks = self.packages.${system}; + hydraJobs = self.packages.${system}; - devShell = pkgs.mkShell { - buildInputs = with pkgs; [ + devShell = pkgs.mkShell { + buildInputs = with pkgs; [ rust-analyzer rustc rustfmt @@ -38,5 +41,5 @@ clippy ]; }; - }); + }); }