mirror of
https://github.com/ryanccn/attic-action.git
synced 2024-11-19 22:16:35 +00:00
chore: misc cleanups for flake and ci (#12)
This commit is contained in:
parent
40fa276ac0
commit
7f0e30fedd
4 changed files with 30 additions and 26 deletions
7
.github/workflows/release.yml
vendored
7
.github/workflows/release.yml
vendored
|
@ -4,12 +4,13 @@ on:
|
||||||
release:
|
release:
|
||||||
types: [published, edited]
|
types: [published, edited]
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -38,4 +38,4 @@ jobs:
|
||||||
token: ${{ secrets.ATTIC_TOKEN }}
|
token: ${{ secrets.ATTIC_TOKEN }}
|
||||||
|
|
||||||
- name: Build Nix Package
|
- name: Build Nix Package
|
||||||
run: nix build --impure --show-trace -L .#test
|
run: nix-build test.nix
|
||||||
|
|
33
flake.nix
33
flake.nix
|
@ -6,36 +6,25 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {nixpkgs, ...}: let
|
outputs = {nixpkgs, ...}: let
|
||||||
mkSystems = sys: builtins.map (arch: "${arch}-${sys}") ["x86_64" "aarch64"];
|
systems = [
|
||||||
systems =
|
"x86_64-linux"
|
||||||
mkSystems "linux"
|
"aarch64-linux"
|
||||||
++ mkSystems "darwin";
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
|
||||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system});
|
||||||
nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;});
|
|
||||||
|
|
||||||
forEachSystem = fn:
|
|
||||||
forAllSystems (s: fn nixpkgsFor.${s});
|
|
||||||
in {
|
in {
|
||||||
devShells = forEachSystem (pkgs: {
|
devShells = forAllSystems (pkgs: {
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
actionlint
|
actionlint
|
||||||
nodePackages.pnpm
|
nodejs_20
|
||||||
|
(nodePackages_latest.pnpm.override {nodejs = nodejs_20;})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
formatter = forEachSystem (p: p.alejandra);
|
formatter = forAllSystems (p: p.alejandra);
|
||||||
|
|
||||||
packages = forEachSystem (p: let
|
|
||||||
time = toString builtins.currentTime;
|
|
||||||
test = p.runCommand "test-${time}" {} ''
|
|
||||||
echo ${time} > $out
|
|
||||||
'';
|
|
||||||
in {
|
|
||||||
inherit test;
|
|
||||||
default = test;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
14
test.nix
Normal file
14
test.nix
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
let
|
||||||
|
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||||
|
pkgs = import (
|
||||||
|
fetchTarball {
|
||||||
|
url =
|
||||||
|
lock.nodes.nixpkgs.locked.url
|
||||||
|
or "https://github.com/NixOS/nixpkgs/archive/${lock.nodes.nixpkgs.locked.rev}.tar.gz";
|
||||||
|
sha256 = lock.nodes.nixpkgs.locked.narHash;
|
||||||
|
}
|
||||||
|
) {};
|
||||||
|
in
|
||||||
|
pkgs.runCommand "non-reproducible-test" {} ''
|
||||||
|
echo ${toString builtins.currentTime} > $out
|
||||||
|
''
|
Loading…
Reference in a new issue