Update CI; Clean up flake.nix

This commit is contained in:
Agatha Lovelace 2024-01-08 21:35:03 +01:00
parent 66228bbefe
commit 0f3b3ebf88
Signed by: sorceress
GPG Key ID: 01D0B3AB10CED4F8
3 changed files with 22 additions and 12 deletions

View File

@ -1,19 +1,29 @@
name: "Build legacy Nix package on Ubuntu"
on: push
name: "Build Nix package on Ubuntu"
on:
push:
env:
RUSTFLAGS: "-Dwarnings"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v12
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- name: Building package
run: nix-build . -A defaultPackage.x86_64-linux
run: nix build
- name: Get repository name
run: echo "REPO_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Get commit hash
run: echo "COMMIT_HASH=${GITHUB_SHA::6}" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
with:
name: url-eater-${{ env.COMMIT_HASH }}-x86_64-linux
path: result/bin/url-eater
name: ${{ env.REPO_NAME }}-${{ env.COMMIT_HASH }}-x86_64-linux
path: result/bin/${{ env.REPO_NAME }}
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- name: Lint
run: nix develop --command cargo clippy --all-targets --all-features

View File

@ -50,7 +50,7 @@ url-eater.inputs.nixpkgs.follows = "nixpkgs"; #optional
```
3. Import NixOS module
```nix
imports = [ url-eater.nixosModule ];
imports = [ url-eater.nixosModules.default ];
```
4. Configure the module:
```nix

View File

@ -11,8 +11,8 @@
pkgs = import nixpkgs { inherit system; };
naersk-lib = pkgs.callPackage naersk { };
in {
defaultPackage = naersk-lib.buildPackage ./.;
devShell = with pkgs;
packages.default = naersk-lib.buildPackage ./.;
devShells.default = with pkgs;
mkShell {
buildInputs = [
cargo
@ -25,7 +25,7 @@
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
}) // {
nixosModule = { config, lib, pkgs, ... }:
nixosModules.default = { config, lib, pkgs, ... }:
with lib;
let cfg = config.services.url-eater;
in {