Skip to content

Commit

Permalink
nix: add flake
Browse files Browse the repository at this point in the history
  • Loading branch information
abathur committed Sep 15, 2023
1 parent 5e0956b commit e875f88
Show file tree
Hide file tree
Showing 21 changed files with 760 additions and 382 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: touch .local && nix-build ci.nix
- name: ensure demo doesn't rot
run: nix-shell --run "./demo"
nix_path: nixpkgs=channel:nixpkgs-unstable
- run: nix build .#ci
- name: validate core CLI demo
run: nix-shell --run ./demo
- name: validate new CLI demo
run: nix develop --command ./demo
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#! /usr/bin/env make
#export PATH := $(shell nix-shell -p nix coreutils gnused groff util-linux --run 'echo $$PATH')
export PATH := $(shell nix-shell make.nix --run 'echo $$PATH')
export PATH := $(shell nix develop .#make --command sh -c 'echo $$makeInputs')

.PHONY: apologeez ci clean update # lint

Expand All @@ -12,20 +11,17 @@ all: apologeez
install: apologeez
uninstall: apologeez

.local : *.nix setup.cfg setup.py test.sh demo tests/* resholve.1 resholve _resholve/*
touch .local


result-ci: .local
@echo Building ci.nix
@nix-build --out-link nix-result-ci ci.nix
result-ci: *.nix setup.cfg setup.py test.sh demo tests/* resholve.1 resholve _resholve/*
@echo Running Nix CI tests
@nix build .#ci --out-link nix-result-ci
@mkdir -p result-ci
@install -m 644 nix-result-ci/* result-ci/

ci: result-ci

clean:
rm .local nix-result-ci result-ci/* docs/README.nixpkgs.md
rm nix-result-ci result-ci/* docs/README.nixpkgs.md

result-ci/test.txt result-ci/demo.txt result-ci/nix-demo.txt: result-ci

Expand All @@ -49,7 +45,11 @@ resholve.1: docs/manpage.wwst docs/manpage.css docs/content.wwst
@echo Building manpage
@wordswurst $< > $@

docs/README.nixpkgs.md: docs/markdown.wwst docs/markdown.css docs/content.wwst docs/examples/*.nix
nixpkgs_source: flake.lock
@echo linking nixpkgs source into $@
@nix build --out-link nixpkgs_source "$$(nix eval .#nixpkgs_source --raw)"

nixpkgs/README.md: docs/markdown.wwst docs/markdown.css docs/content.wwst docs/examples/*.nix nixpkgs_source
@echo "Building Nixpkgs README (markdown)"
@wordswurst $< > $@

Expand All @@ -66,7 +66,7 @@ _resholve/strings.py: docs/strings.wwst docs/strings.css docs/content.wwst
@echo Wursting $@ from $<
@wordswurst $< > $@

update: timings.md demos.md docs/resholve.1.txt docs/README.nixpkgs.md
update: timings.md demos.md docs/resholve.1.txt nixpkgs/README.md

# lint: lint-sass # lint-nix

Expand Down
27 changes: 0 additions & 27 deletions ci.nix

This file was deleted.

61 changes: 10 additions & 51 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,51 +1,10 @@
{ lib
, pkgs
, pkgsBuildHost
, ...
}:

let
removeKnownVulnerabilities = pkg: pkg.overrideAttrs (old: {
meta = (old.meta or { }) // { knownVulnerabilities = [ ]; };
});
# We are removing `meta.knownVulnerabilities` from `python27`,
# and setting it in `resholve` itself.
python27' = (removeKnownVulnerabilities pkgsBuildHost.python27).override {
self = python27';
pkgsBuildHost = pkgsBuildHost // { python27 = python27'; };
# strip down that python version as much as possible
openssl = null;
bzip2 = null;
readline = null;
ncurses = null;
gdbm = null;
sqlite = null;
rebuildBytecode = false;
stripBytecode = true;
strip2to3 = true;
stripConfig = true;
stripIdlelib = true;
stripTests = true;
enableOptimizations = false;
};
callPackage = lib.callPackageWith (pkgs // { python27 = python27'; });
source = callPackage ./source.nix { };
deps = callPackage ./deps.nix { };
in rec
{
# resholve itself
resholve = removeKnownVulnerabilities (callPackage ./resholve.nix {
inherit (source) rSrc version;
inherit (deps) binlore;
inherit (deps.oil) oildev;
inherit (deps) configargparse;
inherit resholve-utils;
});
# funcs to validate and phrase invocations of resholve
# and use those invocations to build packages
resholve-utils = callPackage ./resholve-utils.nix {
inherit resholve;
inherit (deps) binlore;
};
python27 = python27';
}
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).defaultNix
Loading

0 comments on commit e875f88

Please sign in to comment.