From e6f3fd58ab283867733e940d1287923e6f0efae4 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Wed, 10 Apr 2024 14:19:14 +0100 Subject: [PATCH] Replace flake-utils with flake-part --- .gitignore | 1 + flake.lock | 71 ++++++++++++++++++++++--------------------- flake.nix | 89 +++++++++++++++++++++++++++++------------------------- 3 files changed, 86 insertions(+), 75 deletions(-) diff --git a/.gitignore b/.gitignore index 9065e18..e745588 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,4 @@ flycheck_*.el # Added automatically by ‘eldev init’. /.eldev /Eldev-local +result \ No newline at end of file diff --git a/flake.lock b/flake.lock index 02b0a8c..fa97b8c 100644 --- a/flake.lock +++ b/flake.lock @@ -21,6 +21,24 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -39,24 +57,6 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1707689078, @@ -73,6 +73,24 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1711703276, + "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1707650010, @@ -108,7 +126,7 @@ "root": { "inputs": { "emacs-overlay": "emacs-overlay", - "flake-utils": "flake-utils_2", + "flake-parts": "flake-parts", "nixpkgs": "nixpkgs_2" } }, @@ -126,21 +144,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 77cde80..a69420a 100644 --- a/flake.nix +++ b/flake.nix @@ -25,56 +25,63 @@ inputs.nixpkgs.url = "github:NixOS/nixpkgs/442d407992384ed9c0e6d352de75b69079904e4e"; inputs.emacs-overlay.url = "github:nix-community/emacs-overlay/0f7f3b39157419f3035a2dad39fbaf8a4ba0448d"; - inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.flake-parts.url = "github:hercules-ci/flake-parts"; - outputs = { self, nixpkgs, ... }@inputs: - inputs.flake-utils.lib.eachDefaultSystem (system: - let - pkgs = import nixpkgs { - inherit system; - overlays = [ inputs.emacs-overlay.overlays.package ]; - }; + outputs = { self, nixpkgs, flake-parts, ... }@inputs: flake-parts.lib.mkFlake { inherit inputs; } ( + { + systems = [ + "aarch64-darwin" + "riscv64-linux" + "riscv32-linux" + "x86_64-linux" + "x86_64-windows" + ]; + + perSystem = { config, pkgs, system, ... }: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ inputs.emacs-overlay.overlays.package ]; + }; + emacs = pkgs.emacs29.override { + } // (pkgs.lib.optionalAttrs (pkgs.stdenv.isLinux) { + # Gtk causes a flickering issue on WM mode + withGTK3 = false; + toolkit = "lucid"; + }); - emacs = pkgs.emacs29.override { - } // (pkgs.lib.optionalAttrs (pkgs.stdenv.isLinux) { - # Gtk causes a flickering issue on WM mode - withGTK3 = false; - toolkit = "lucid"; - }); + noether = pkgs.emacsPackages.trivialBuild { + pname = "noether-mode"; + version = "0.1.5"; + buildInputs = [ pkgs.emacsPackages.posframe ]; + src = ./.; + }; - noether = pkgs.emacsPackages.trivialBuild { - pname = "noether-mode"; - version = "0.1.5"; - buildInputs = [ pkgs.emacsPackages.posframe ]; + emacsPkgs = (pkgs.emacsPackagesFor emacs).withPackages (epkgs: [ + epkgs.projectile + epkgs.posframe + noether + ]); - src = ./.; - }; + test-noether = pkgs.writeShellApplication { + name = "test-noether"; + runtimeInputs = [ emacsPkgs ]; - emacsPkgs = (pkgs.emacsPackagesFor emacs).withPackages (epkgs: [ - epkgs.projectile - epkgs.posframe - noether - ]); - - test-noether = pkgs.writeShellApplication { - name = "test-noether"; - runtimeInputs = [ emacsPkgs ]; - - text = '' + text = '' ${emacsPkgs}/bin/emacs -Q -l ./test-noether.el "$@" ''; + }; + + in { + packages.default = noether; + devShells.default = pkgs.mkShell { + nativeBuildInputs = [ noether emacsPkgs test-noether ]; + buildInputs = [ noether emacsPkgs ]; + }; + }; - in { - packages.default = noether; - packages.${system}.default = noether; - - devShells.default = pkgs.mkShell { - nativeBuildInputs = [ noether emacsPkgs test-noether ]; - buildInputs = [ noether emacsPkgs ]; - }; - } - ); + }); }