diff --git a/.github/workflows/cachix.yml b/.github/workflows/cachix.yml index 9f035354..4a4660e5 100644 --- a/.github/workflows/cachix.yml +++ b/.github/workflows/cachix.yml @@ -6,19 +6,19 @@ jobs: name: "Build" runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: recursive + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive - - uses: cachix/install-nix-action@v25 - - uses: DeterminateSystems/magic-nix-cache-action@main - - uses: cachix/cachix-action@v12 - with: - name: ags - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - uses: cachix/install-nix-action@v25 + - uses: DeterminateSystems/magic-nix-cache-action@main + - uses: cachix/cachix-action@v12 + with: + name: ags + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - name: Build ags - run: | - nix build --print-build-logs - nix build --print-build-logs .#agsWithTypes + - name: Build ags + run: | + nix build --print-build-logs + nix build --print-build-logs .#agsWithTypes diff --git a/flake.lock b/flake.lock index bb5d5cd8..b62ff7af 100644 --- a/flake.lock +++ b/flake.lock @@ -18,7 +18,23 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index aaca0c42..a5fff0bc 100644 --- a/flake.nix +++ b/flake.nix @@ -3,29 +3,35 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + # «https://github.com/nix-systems/nix-systems» + systems.url = "github:nix-systems/default-linux"; }; outputs = { nixpkgs, self, + systems, }: let version = builtins.replaceStrings ["\n"] [""] (builtins.readFile ./version); - genSystems = nixpkgs.lib.genAttrs [ - "aarch64-linux" - "x86_64-linux" - ]; + genSystems = nixpkgs.lib.genAttrs (import systems); pkgs = genSystems (system: import nixpkgs {inherit system;}); in { - packages = genSystems (system: rec { - default = pkgs.${system}.callPackage ./nix {inherit version;}; - ags = default; - agsWithTypes = default; # for backwards compatibility - agsNoTypes = pkgs.${system}.callPackage ./nix { + packages = genSystems (system: let + inherit (pkgs.${system}) callPackage; + in { + default = callPackage ./nix {inherit version;}; + ags = self.packages.${system}.default; + agsWithTypes = self.packages.${system}.default; # for backwards compatibility + agsNoTypes = callPackage ./nix { inherit version; buildTypes = false; }; }); - homeManagerModules.default = import ./nix/hm-module.nix self; + homeManagerModules = { + default = self.homeManagerModules.ags; + ags = import ./nix/hm-module.nix self; + }; }; } diff --git a/nix/default.nix b/nix/default.nix index f20f04d7..fbb1e59a 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,32 +1,33 @@ -{ lib -, stdenv -, buildNpmPackage -, fetchFromGitLab -, nodePackages -, meson -, pkg-config -, ninja -, gobject-introspection -, gtk3 -, libpulseaudio -, gjs -, wrapGAppsHook -, upower -, gnome -, gtk-layer-shell -, glib-networking -, networkmanager -, libdbusmenu-gtk3 -, gvfs -, libsoup_3 -, libnotify -, pam -, extraPackages ? [ ] -, version ? "git" -, buildTypes ? true -}: +{ + lib, + stdenv, + buildNpmPackage, + fetchFromGitLab, + nodePackages, + meson, + pkg-config, + ninja, + gobject-introspection, + gtk3, + libpulseaudio, + gjs, + wrapGAppsHook, + upower, + gnome, + gtk-layer-shell, + glib-networking, + networkmanager, + libdbusmenu-gtk3, + gvfs, + libsoup_3, + libnotify, + pam, + extraPackages ? [], + version ? "git", + buildTypes ? true, +}: let + pname = "ags"; -let gvc-src = fetchFromGitLab { domain = "gitlab.gnome.org"; owner = "GNOME"; @@ -35,70 +36,74 @@ let sha256 = "sha256-FosJwgTCp6/EI6WVbJhPisokRBA6oT0eo7d+Ya7fFX8="; }; in -stdenv.mkDerivation rec { - pname = "ags"; - inherit version; + stdenv.mkDerivation { + inherit pname version; - src = buildNpmPackage { - name = pname; - src = lib.cleanSource ../.; + src = buildNpmPackage { + name = pname; + src = lib.cleanSource ../.; - dontBuild = true; + dontBuild = true; - npmDepsHash = "sha256-ucWdADdMqAdLXQYKGOXHNRNM9bhjKX4vkMcQ8q/GZ20="; + npmDepsHash = "sha256-ucWdADdMqAdLXQYKGOXHNRNM9bhjKX4vkMcQ8q/GZ20="; - installPhase = '' - mkdir $out - cp -r * $out - ''; - }; + installPhase = '' + runHook preInstall + mkdir $out + cp -r * $out + runHook postInstall + ''; + }; - mesonFlags = [ - "-Dbuild_types=${if buildTypes then "true" else "false"}" - ]; + nativeBuildInputs = [ + pkg-config + meson + ninja + nodePackages.typescript + wrapGAppsHook + gobject-introspection + ]; - prePatch = '' - mkdir -p ./subprojects/gvc - cp -r ${gvc-src}/* ./subprojects/gvc - ''; + buildInputs = + [ + gjs + gtk3 + libpulseaudio + upower + gnome.gnome-bluetooth + gtk-layer-shell + glib-networking + networkmanager + libdbusmenu-gtk3 + gvfs + libsoup_3 + libnotify + pam + ] + ++ extraPackages; - postPatch = '' - chmod +x post_install.sh - patchShebangs post_install.sh - ''; + mesonFlags = [ + (lib.mesonBool "build_types" buildTypes) + ]; - nativeBuildInputs = [ - pkg-config - meson - ninja - nodePackages.typescript - wrapGAppsHook - gobject-introspection - ]; + prePatch = '' + mkdir -p ./subprojects/gvc + cp -r ${gvc-src}/* ./subprojects/gvc + ''; - buildInputs = [ - gjs - gtk3 - libpulseaudio - upower - gnome.gnome-bluetooth - gtk-layer-shell - glib-networking - networkmanager - libdbusmenu-gtk3 - gvfs - libsoup_3 - libnotify - pam - ] ++ extraPackages; + postPatch = '' + chmod +x post_install.sh + patchShebangs post_install.sh + ''; - outputs = [ "out" "lib" ]; + outputs = ["out" "lib"]; - meta = with lib; { - description = "A customizable and extensible shell"; - homepage = "https://github.com/Aylur/ags"; - platforms = [ "x86_64-linux" "aarch64-linux" ]; - license = licenses.gpl3; - meta.maintainers = [ lib.maintainers.Aylur ]; - }; -} + meta = { + description = "A customizable and extensible shell"; + homepage = "https://github.com/Aylur/ags"; + changelog = "https://github.com/Aylur/ags/blob/${version}/CHANGELOG.md"; + platforms = ["x86_64-linux" "aarch64-linux"]; + license = lib.licenses.gpl3; + meta.maintainers = [lib.maintainers.Aylur]; + }; + }