👷 Swap to simpler Nix flake–based environment

This commit is contained in:
David Pätzel 2023-04-26 15:40:05 +02:00
parent 6e139370a5
commit 5c448dce09
7 changed files with 103 additions and 20 deletions

View File

@ -1,7 +1,7 @@
{ mkDerivation, base, Cabal, extra, monad-loops, MonadRandom { mkDerivation, base, Cabal, cassava, extra, lib, monad-loops
, optparse-applicative, pipes, protolude, QuickCheck , MonadRandom, optparse-applicative, pipes, protolude, QuickCheck
, quickcheck-instances, random, random-fu, random-shuffle, stdenv , quickcheck-instances, random, random-fu, random-shuffle, text
, text , wl-pprint-text
}: }:
mkDerivation { mkDerivation {
pname = "haga"; pname = "haga";
@ -10,15 +10,16 @@ mkDerivation {
isLibrary = true; isLibrary = true;
isExecutable = true; isExecutable = true;
libraryHaskellDepends = [ libraryHaskellDepends = [
base extra monad-loops MonadRandom optparse-applicative pipes base cassava extra monad-loops MonadRandom optparse-applicative
protolude QuickCheck quickcheck-instances random random-fu pipes protolude QuickCheck quickcheck-instances random random-fu
random-shuffle text random-shuffle text wl-pprint-text
]; ];
executableHaskellDepends = [ executableHaskellDepends = [
base Cabal extra monad-loops MonadRandom optparse-applicative pipes base Cabal cassava extra monad-loops MonadRandom
protolude QuickCheck quickcheck-instances random random-fu optparse-applicative pipes protolude QuickCheck
random-shuffle text quickcheck-instances random random-fu random-shuffle text
wl-pprint-text
]; ];
description = "Simplistic genetic algorithms library"; description = "Simplistic genetic algorithms library";
license = stdenv.lib.licenses.gpl3; license = lib.licenses.gpl3Only;
} }

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1655624069,
"narHash": "sha256-7g1zwTdp35GMTERnSzZMWJ7PG3QdDE8VOX3WsnOkAtM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0d68d7c857fe301d49cdcd56130e0beea4ecd5aa",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0d68d7c857fe301d49cdcd56130e0beea4ecd5aa",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

24
flake.nix Normal file
View File

@ -0,0 +1,24 @@
{
description = "Flake for haga";
inputs = {
nixpkgs.url =
# 2022-06-22
"github:NixOS/nixpkgs/0d68d7c857fe301d49cdcd56130e0beea4ecd5aa";
};
outputs = inputs@{ self, nixpkgs }:
with import nixpkgs {
system = "x86_64-linux";
}; {
# defaultPackage.${system} = haskellPackages.callPackage ./default.nix { };
devShell.${system} = mkShell {
buildInputs = [
feedgnuplot
haskellPackages.cabal-install
haskellPackages.ormolu
haskell.compiler.ghc8107
];
};
};
}

View File

@ -20,7 +20,8 @@ category: Optimization
build-type: Simple build-type: Simple
library library
build-depends: base ^>=4.13.0.0 build-depends: base ^>=4.14.0.0
, cassava
, extra , extra
, MonadRandom , MonadRandom
, monad-loops , monad-loops
@ -30,9 +31,11 @@ library
, QuickCheck , QuickCheck
, quickcheck-instances , quickcheck-instances
, random , random
, random-fu -- 0.3.0.0 introduces at least one truly breaking change.
, random-fu <0.3.0.0
, random-shuffle , random-shuffle
, text , text
, wl-pprint-text
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall -Wno-name-shadowing -Wno-orphans ghc-options: -Wall -Wno-name-shadowing -Wno-orphans
hs-source-dirs: src hs-source-dirs: src
@ -40,9 +43,12 @@ library
, Seminar , Seminar
, Pretty , Pretty
, Szenario191 , Szenario191
, Szenario202
, Analysis
executable haga executable haga
build-depends: base ^>=4.13.0.0 build-depends: base ^>=4.14.0.0
, cassava
, extra , extra
, MonadRandom , MonadRandom
, monad-loops , monad-loops
@ -52,9 +58,11 @@ executable haga
, QuickCheck , QuickCheck
, quickcheck-instances , quickcheck-instances
, random , random
, random-fu -- 0.3.0.0 introduces at least one truly breaking change.
, random-fu <0.3.0.0
, random-shuffle , random-shuffle
, text , text
, wl-pprint-text
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall -Wno-name-shadowing -Wno-orphans ghc-options: -Wall -Wno-name-shadowing -Wno-orphans
hs-source-dirs: src hs-source-dirs: src
@ -63,9 +71,11 @@ executable haga
, Seminar , Seminar
, Pretty , Pretty
, Szenario191 , Szenario191
, Szenario202
executable haga-test executable haga-test
build-depends: base ^>=4.13.0.0 build-depends: base ^>=4.14.0.0
, cassava
, Cabal , Cabal
, extra , extra
, MonadRandom , MonadRandom
@ -76,9 +86,11 @@ executable haga-test
, QuickCheck , QuickCheck
, quickcheck-instances , quickcheck-instances
, random , random
, random-fu -- 0.3.0.0 introduces at least one truly breaking change.
, random-fu <0.3.0.0
, random-shuffle , random-shuffle
, text , text
, wl-pprint-text
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall -Wno-name-shadowing -Wno-orphans ghc-options: -Wall -Wno-name-shadowing -Wno-orphans
hs-source-dirs: src hs-source-dirs: src

17
haga.md Normal file
View File

@ -0,0 +1,17 @@
# Building
```
nix develop
cabal update
cabal build
```
# Running
```
nix develop
fish run
```

View File

@ -1,11 +1,12 @@
* PROJECT haga * PROJECT haga
** TODO see TODOs in code ** TODO See TODOs in code
** MAYBE Add factory floor optimizer ** MAYBE Add factory floor optimizer
GA that optimizes factory floor GA that optimizes factory floor
- data: graph of workstations with edge weights being the number of walks - data: graph of workstations with edge weights being the number of walks
between them between them
- desired: optimal configuration that reduces crossings - desired: optimal configuration that reduces crossings
- space: 15 workstations that can be positioned in a 20 x 20 space - space: 15 workstations that can be positioned in a 20 x 20 space
** MAYBE Implement simple lcs in haga
* Unsorted ideas * Unsorted ideas
- https://github.com/mikeizbicki/HerbiePlugin - https://github.com/mikeizbicki/HerbiePlugin
- https://github.com/mikeizbicki/subhask - https://github.com/mikeizbicki/subhask

5
run
View File

@ -1,9 +1,10 @@
#! /usr/bin/env nix-shell #! /usr/bin/env nix-shell
#! nix-shell -i fish -p fish feedgnuplot
set exe (fd --type f '^haga$' dist-newstyle/) set exe (fd --type f '^haga$' dist-newstyle/)
"$exe" $argv | \
"$exe" --iterations=10000 $argv | \
# dist-newstyle/build/x86_64-linux/ghc-8.6.5/ga-0.1.0.0/x/ga/build/ga/ga $argv | \ # dist-newstyle/build/x86_64-linux/ghc-8.6.5/ga-0.1.0.0/x/ga/build/ga/ga $argv | \
feedgnuplot \ feedgnuplot \
--terminal "x11 background '#ffffff'" \ --terminal "x11 background '#ffffff'" \