From 56f7efc27b03b706a5d3df0d8230a2ee1f262d06 Mon Sep 17 00:00:00 2001 From: aleksana Date: Fri, 6 Oct 2023 23:40:50 +0800 Subject: [PATCH] Added Nix flake Nix flake makes it easy to make CI tests, reproduce bugs and provide NixOS users with latest -git version. --- .gitignore | 10 +++++++++ flake.lock | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 35 +++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 48835df..a0547f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,12 @@ /build/ *.user + +# Direnv +.direnv/ + +# pre-commit-hooks +.pre-commit-config.yaml + +# Nix +result +result-* diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5ff3ebb --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1696343447, + "narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1696193975, + "narHash": "sha256-mnQjUcYgp9Guu3RNVAB2Srr1TqKcPpRXmJf4LJk6KRY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fdd898f8f79e8d2f99ed2ab6b3751811ef683242", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1696019113, + "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8597b39 --- /dev/null +++ b/flake.nix @@ -0,0 +1,35 @@ +{ + description = "A graphical application for configuring displays in Wayland compositors"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + }; + + outputs = inputs@{ self, nixpkgs, flake-parts }: flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" "aarch64-linux" ]; + perSystem = { pkgs, system, ... }: { + packages = rec { + wdisplays = pkgs.stdenv.mkDerivation { + pname = "wdisplays"; + version = "git"; + + src = pkgs.lib.cleanSource ./.; + + nativeBuildInputs = with pkgs; [ meson ninja pkg-config wrapGAppsHook ]; + + buildInputs = with pkgs; [ gtk3 libepoxy wayland ]; + + meta = with pkgs.lib; { + description = "A graphical application for configuring displays in Wayland compositors"; + homepage = "https://github.com/cyclopsian/wdisplays"; + license = licenses.gpl3Plus; + platforms = platforms.linux; + mainProgram = "wdisplays"; + }; + }; + default = wdisplays; + }; + }; + }; +}