From 6335946eebbccfd58c7198d74eed9f9fd3f50054 Mon Sep 17 00:00:00 2001 From: EEva Date: Sun, 4 Dec 2022 18:52:49 +0200 Subject: [PATCH] Add flake support --- .envrc | 2 +- flake.lock | 43 +++++++++++++++++++++++++++++++++++++++++++ flake.nix | 19 +++++++++++++++++++ shell.nix | 2 +- 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc index 1d953f4..3550a30 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use nix +use flake diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..904b3f7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1670064435, + "narHash": "sha256-+ELoY30UN+Pl3Yn7RWRPabykwebsVK/kYE9JsIsUMxQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "61a8a98e6d557e6dd7ed0cdb54c3a3e3bbc5e25c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..31c4e8e --- /dev/null +++ b/flake.nix @@ -0,0 +1,19 @@ +{ + description = "Build my xmonad config"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, nixpkgs, flake-utils }: + + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; in + { + devShells.default = import ./shell.nix { inherit pkgs; }; + }) // { + packages.x86_64-linux.default = + # Notice the reference to nixpkgs here. + with import nixpkgs { system = "x86_64-linux"; }; + haskellPackages.callCabal2nix "xmonad-config" ./. {}; + }; +} diff --git a/shell.nix b/shell.nix index 45439b6..7adb3d9 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,4 @@ -{ pkgs ? import { } }: +{ pkgs }: let inherit (pkgs) callPackage fetchFromGitHub mkShell; easy-hls-src = fetchFromGitHub {